From 1a062b85f0f445d786c658a4f3687c07011810dc Mon Sep 17 00:00:00 2001 From: Akio Nakamura Date: Tue, 19 Feb 2019 15:03:46 +0900 Subject: [PATCH] tests: remove byte.hex() to keep compatibility 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/mining_basic.py | 2 +- test/functional/wallet_txn_clone.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py index df8fe23a2..d0bef48cb 100755 --- a/test/functional/mining_basic.py +++ b/test/functional/mining_basic.py @@ -184,7 +184,7 @@ class MiningTest(BitcoinTestFramework): 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() diff --git a/test/functional/wallet_txn_clone.py b/test/functional/wallet_txn_clone.py index 2f927502f..a0a35bf43 100755 --- a/test/functional/wallet_txn_clone.py +++ b/test/functional/wallet_txn_clone.py @@ -8,6 +8,7 @@ import io 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, @@ -81,7 +82,7 @@ class TxnMallTest(BitcoinTestFramework): # 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: