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