From fa0a58a280fe89c629ce030ea70ea38fa395522b Mon Sep 17 00:00:00 2001 From: "John L. Jegutanis" Date: Mon, 13 Aug 2018 14:44:07 +0200 Subject: [PATCH] Rename struct pack/unpack to reflect endianess --- electrumx/lib/tx.py | 14 +++++++------- electrumx/lib/util.py | 30 +++++++++++++++--------------- electrumx/server/daemon.py | 4 ++-- tests/lib/test_util.py | 20 ++++++++++---------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/electrumx/lib/tx.py b/electrumx/lib/tx.py index 35fa419..8dc5d55 100644 --- a/electrumx/lib/tx.py +++ b/electrumx/lib/tx.py @@ -31,8 +31,8 @@ from collections import namedtuple from electrumx.lib.hash import sha256, double_sha256, hash_to_hex_str from electrumx.lib.util import ( - cachedproperty, unpack_int32_from, unpack_int64_from, - unpack_uint16_from, unpack_uint32_from, unpack_uint64_from, + cachedproperty, unpack_le_int32_from, unpack_le_int64_from, + unpack_le_uint16_from, unpack_le_uint32_from, unpack_le_uint64_from, pack_le_int32, pack_varint, pack_le_uint32, pack_le_uint32, pack_le_int64, pack_varbytes, ) @@ -185,27 +185,27 @@ class Deserializer(object): return self._read_le_uint64() def _read_le_int32(self): - result, = unpack_int32_from(self.binary, self.cursor) + result, = unpack_le_int32_from(self.binary, self.cursor) self.cursor += 4 return result def _read_le_int64(self): - result, = unpack_int64_from(self.binary, self.cursor) + result, = unpack_le_int64_from(self.binary, self.cursor) self.cursor += 8 return result def _read_le_uint16(self): - result, = unpack_uint16_from(self.binary, self.cursor) + result, = unpack_le_uint16_from(self.binary, self.cursor) self.cursor += 2 return result def _read_le_uint32(self): - result, = unpack_uint32_from(self.binary, self.cursor) + result, = unpack_le_uint32_from(self.binary, self.cursor) self.cursor += 4 return result def _read_le_uint64(self): - result, = unpack_uint64_from(self.binary, self.cursor) + result, = unpack_le_uint64_from(self.binary, self.cursor) self.cursor += 8 return result diff --git a/electrumx/lib/util.py b/electrumx/lib/util.py index 991cd88..c55037a 100644 --- a/electrumx/lib/util.py +++ b/electrumx/lib/util.py @@ -330,24 +330,24 @@ def protocol_version(client_req, min_tuple, max_tuple): return result, client_min -structi = Struct('