aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_segwit.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-07-31 21:23:16 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-08-01 19:26:51 +0200
commitca6c154ef116e8d2e0484cdb1af13b34a0c86c17 (patch)
tree4b38a878a5b2fd0f49a2cc0b0e1948b8119b40e9 /test/functional/p2p_segwit.py
parentf2e41d11097dde1c841bcaa8615886c984f71632 (diff)
downloadbitcoin-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_segwit.py')
-rwxr-xr-xtest/functional/p2p_segwit.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index 929efdd91c..c53feaf0c6 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -81,7 +81,6 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
softfork_active,
- hex_str_to_bytes,
assert_raises_rpc_error,
)
@@ -415,7 +414,7 @@ class SegWitTest(BitcoinTestFramework):
block = self.test_node.request_block(block_hash, 2)
wit_block = self.test_node.request_block(block_hash, 2 | MSG_WITNESS_FLAG)
assert_equal(block.serialize(), wit_block.serialize())
- assert_equal(block.serialize(), hex_str_to_bytes(rpc_block))
+ assert_equal(block.serialize(), bytes.fromhex(rpc_block))
else:
# After activation, witness blocks and non-witness blocks should
# be different. Verify rpc getblock() returns witness blocks, while
@@ -430,7 +429,7 @@ class SegWitTest(BitcoinTestFramework):
rpc_block = self.nodes[0].getblock(block.hash, False)
non_wit_block = self.test_node.request_block(block.sha256, 2)
wit_block = self.test_node.request_block(block.sha256, 2 | MSG_WITNESS_FLAG)
- assert_equal(wit_block.serialize(), hex_str_to_bytes(rpc_block))
+ assert_equal(wit_block.serialize(), bytes.fromhex(rpc_block))
assert_equal(wit_block.serialize(False), non_wit_block.serialize())
assert_equal(wit_block.serialize(), block.serialize())