test: refactor: remove hex_str_to_bytes helper

Use the built-in class method bytes.fromhex() instead,
which is available since Python 3.0.
This commit is contained in:
Sebastian Falbesoner committed 2021-08-01 19:26:51 +02:00
1 parent f2e41d1109
commit ca6c154ef1
15 files changed
+40 -57

No files matched your search

+2 -2
View File
@@ -30,7 +30,7 @@ import struct
import time
from test_framework.siphash import siphash256
from test_framework.util import hex_str_to_bytes, assert_equal
from test_framework.util import assert_equal
MAX_LOCATOR_SZ = 101
MAX_BLOCK_BASE_SIZE = 1000000
@@ -197,7 +197,7 @@ def from_hex(obj, hex_string):
Note that there is no complementary helper like e.g. `to_hex` for the
inverse operation. To serialize a message object to a hex string, simply
use obj.serialize().hex()"""
obj.deserialize(BytesIO(hex_str_to_bytes(hex_string)))
obj.deserialize(BytesIO(bytes.fromhex(hex_string)))
return obj