Skip to content

Commit

Permalink
tests: remove byte.hex() to keep compatibility
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
AkioNak committed Feb 19, 2019
1 parent 904308d commit 1a062b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/functional/mining_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def assert_submitblock(block, result_str_1, result_str_2=None):
self.log.info('submitheader tests')
assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='xx' * BLOCK_HEADER_SIZE))
assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='ff' * (BLOCK_HEADER_SIZE-2)))
assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata=super(CBlock, bad_block).serialize().hex()))
assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata=b2x(super(CBlock, bad_block).serialize())))

block.nTime += 1
block.solve()
Expand Down
3 changes: 2 additions & 1 deletion test/functional/wallet_txn_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
bytes_to_hex_str as b2x,
connect_nodes,
disconnect_nodes,
sync_blocks,
Expand Down Expand Up @@ -81,7 +82,7 @@ def run_test(self):

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

# Have node0 mine a block, if requested:
Expand Down

0 comments on commit 1a062b8

Please sign in to comment.