Skip to content

Commit f9775a8

Browse files
author
MarcoFalke
committed
Merge #15439: tests: remove byte.hex() to keep compatibility
1a062b8 tests: remove byte.hex() to keep compatibility (Akio Nakamura) Pull request description: Use ```test_framework.util.bytes_to_hex_str()``` instead of ```bytes.hex()``` that new in Python 3.5 to support minimum version of Python(test). ```test/functional/test_framework/wallet_util.py``` is also reported to have '\.hex()' in #15397, but it does not matter because it calls CScript.hex() defined in wallet_util.py. Tree-SHA512: 1019212e965f0848d235fab4da11959dffa42e8adfcd41216c10795cfc63c804b5deb5a3317f25d29940b9dcf088ab76fe3fa80d2679dc19f5f482dc5bde3283
2 parents 38429c4 + 1a062b8 commit f9775a8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

test/functional/mining_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def assert_submitblock(block, result_str_1, result_str_2=None):
184184
self.log.info('submitheader tests')
185185
assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='xx' * BLOCK_HEADER_SIZE))
186186
assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='ff' * (BLOCK_HEADER_SIZE-2)))
187-
assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata=super(CBlock, bad_block).serialize().hex()))
187+
assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata=b2x(super(CBlock, bad_block).serialize())))
188188

189189
block.nTime += 1
190190
block.solve()

test/functional/wallet_txn_clone.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from test_framework.test_framework import BitcoinTestFramework
99
from test_framework.util import (
1010
assert_equal,
11+
bytes_to_hex_str as b2x,
1112
connect_nodes,
1213
disconnect_nodes,
1314
sync_blocks,
@@ -81,7 +82,7 @@ def run_test(self):
8182

8283
# Use a different signature hash type to sign. This creates an equivalent but malleated clone.
8384
# Don't send the clone anywhere yet
84-
tx1_clone = self.nodes[0].signrawtransactionwithwallet(clone_tx.serialize().hex(), None, "ALL|ANYONECANPAY")
85+
tx1_clone = self.nodes[0].signrawtransactionwithwallet(b2x(clone_tx.serialize()), None, "ALL|ANYONECANPAY")
8586
assert_equal(tx1_clone["complete"], True)
8687

8788
# Have node0 mine a block, if requested:

0 commit comments

Comments
 (0)