aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/listtransactions.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-04-10 16:54:28 +0200
committerMarcoFalke <falke.marco@gmail.com>2016-04-10 20:35:57 +0200
commitfaa41ee204124da19dcf1e5b8a3aef1e216bf5e6 (patch)
tree4b33bcb6db57bcde90e12d1b0e9140c4d8cb32ba /qa/rpc-tests/listtransactions.py
parent0afac87e8173dd71616e211aa08dcd59cb5cf90e (diff)
[qa] py2: Unfiddle strings into bytes explicitly
Diffstat (limited to 'qa/rpc-tests/listtransactions.py')
-rwxr-xr-xqa/rpc-tests/listtransactions.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/qa/rpc-tests/listtransactions.py b/qa/rpc-tests/listtransactions.py
index 8fe72d95d1..0783a1f3d3 100755
--- a/qa/rpc-tests/listtransactions.py
+++ b/qa/rpc-tests/listtransactions.py
@@ -9,11 +9,10 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.mininode import CTransaction, COIN
from io import BytesIO
-import binascii
def txFromHex(hexstring):
tx = CTransaction()
- f = BytesIO(binascii.unhexlify(hexstring))
+ f = BytesIO(hex_str_to_bytes(hexstring))
tx.deserialize(f)
return tx
@@ -167,7 +166,7 @@ class ListTransactionsTest(BitcoinTestFramework):
tx3 = self.nodes[0].createrawtransaction(inputs, outputs)
tx3_modified = txFromHex(tx3)
tx3_modified.vin[0].nSequence = 0
- tx3 = binascii.hexlify(tx3_modified.serialize()).decode('utf-8')
+ tx3 = bytes_to_hex_str(tx3_modified.serialize())
tx3_signed = self.nodes[0].signrawtransaction(tx3)['hex']
txid_3 = self.nodes[0].sendrawtransaction(tx3_signed)
@@ -193,7 +192,7 @@ class ListTransactionsTest(BitcoinTestFramework):
# Replace tx3, and check that tx4 becomes unknown
tx3_b = tx3_modified
tx3_b.vout[0].nValue -= int(Decimal("0.004") * COIN) # bump the fee
- tx3_b = binascii.hexlify(tx3_b.serialize()).decode('utf-8')
+ tx3_b = bytes_to_hex_str(tx3_b.serialize())
tx3_b_signed = self.nodes[0].signrawtransaction(tx3_b)['hex']
txid_3b = self.nodes[0].sendrawtransaction(tx3_b_signed, True)
assert(is_opt_in(self.nodes[0], txid_3b))