diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-07-31 21:23:16 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-08-01 19:26:51 +0200 |
commit | ca6c154ef116e8d2e0484cdb1af13b34a0c86c17 (patch) | |
tree | 4b38a878a5b2fd0f49a2cc0b0e1948b8119b40e9 /test/functional/p2p_invalid_messages.py | |
parent | f2e41d11097dde1c841bcaa8615886c984f71632 (diff) | |
download | bitcoin-ca6c154ef116e8d2e0484cdb1af13b34a0c86c17.tar.xz |
test: refactor: remove `hex_str_to_bytes` helper
Use the built-in class method bytes.fromhex() instead,
which is available since Python 3.0.
Diffstat (limited to 'test/functional/p2p_invalid_messages.py')
-rwxr-xr-x | test/functional/p2p_invalid_messages.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/functional/p2p_invalid_messages.py b/test/functional/p2p_invalid_messages.py index 9c34506320..f3b80abb59 100755 --- a/test/functional/p2p_invalid_messages.py +++ b/test/functional/p2p_invalid_messages.py @@ -28,7 +28,6 @@ from test_framework.p2p import ( from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, - hex_str_to_bytes, ) VALID_DATA_LIMIT = MAX_PROTOCOL_MESSAGE_LENGTH - 5 # Account for the 5-byte length prefix @@ -187,7 +186,7 @@ class InvalidMessagesTest(BitcoinTestFramework): [ 'received: addrv2 (1 bytes)', ], - hex_str_to_bytes('00')) + bytes.fromhex('00')) def test_addrv2_too_long_address(self): self.test_addrv2('too long address', @@ -196,7 +195,7 @@ class InvalidMessagesTest(BitcoinTestFramework): 'ProcessMessages(addrv2, 525 bytes): Exception', 'Address too long: 513 > 512', ], - hex_str_to_bytes( + bytes.fromhex( '01' + # number of entries '61bc6649' + # time, Fri Jan 9 02:54:25 UTC 2009 '00' + # service flags, COMPACTSIZE(NODE_NONE) @@ -213,7 +212,7 @@ class InvalidMessagesTest(BitcoinTestFramework): 'IP 9.9.9.9 mapped', 'Added 1 addresses', ], - hex_str_to_bytes( + bytes.fromhex( '02' + # number of entries # this should be ignored without impeding acceptance of subsequent ones now_hex + # time |