From 018faa07d1ccdece14b83a22527cc2042cacd01e Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Tue, 22 Oct 2019 13:37:30 +0100 Subject: [PATCH] Fixes change endianness Porting change_endianness from Python2 to Python3 introduced a bug. --- test/simulator/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/simulator/utils.py b/test/simulator/utils.py index f2f2883..98ac072 100644 --- a/test/simulator/utils.py +++ b/test/simulator/utils.py @@ -1,6 +1,6 @@ # Porting some functionality from https://github.com/sr-gi/bitcoin_tools with some modifications <3 from hashlib import sha256 -from binascii import unhexlify +from binascii import unhexlify, hexlify def change_endianness(x): @@ -15,9 +15,9 @@ def change_endianness(x): if (len(x) % 2) == 1: x += "0" - y = bytes(x, 'utf-8') + y = unhexlify(x) z = y[::-1] - return z.decode('utf-8') + return hexlify(z).decode('utf-8') def parse_varint(tx):