This fixes a bug in a functional test. The bug was detected after Core started running CI tests for a big endian platform.
This is a partial backport of Core [[https://github.com/bitcoin/bitcoin/pull/17599 | PR17599]]
https://github.com/bitcoin/bitcoin/pull/17599/commits/fad9fdbea5dfb19328282afda9588edc6f1d0ddf