mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-30 07:47:36 +01:00
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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user