From 96bf0bca4a0e3aa0b7c07d8c225861e72f970fa9 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Sun, 23 Apr 2023 02:36:08 +0200 Subject: [PATCH] test: simplify uint256 (de)serialization routines These routines look fancy, but do nothing more than converting between byte objects of length 32 to/from integers in little endian byte order and can be replaced by simple one-liners, using the int.{from,to}_bytes methods (available since Python 3.2). --- test/functional/test_framework/messages.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 8c6f68cacbb..a6764365c54 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -93,6 +93,7 @@ def ser_compact_size(l): r = struct.pack(">= 32 - return rs + return u.to_bytes(32, 'little') def uint256_from_str(s): - r = 0 - t = struct.unpack("