diff --git a/qa/rpc-tests/tx_expiry_helper.py b/qa/rpc-tests/tx_expiry_helper.py index 36d1b2a4f..e3dd2e2d6 100755 --- a/qa/rpc-tests/tx_expiry_helper.py +++ b/qa/rpc-tests/tx_expiry_helper.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # Copyright (c) 2019 The Zcash developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://www.opensource.org/licenses/mit-license.php . @@ -7,9 +8,9 @@ # from test_framework.mininode import CTransaction, NodeConnCB, mininode_lock, msg_ping, \ msg_pong -from test_framework.util import fail +from test_framework.util import fail, hex_str_to_bytes, bytes_to_hex_str -import cStringIO +import io import time from binascii import hexlify, unhexlify @@ -86,13 +87,13 @@ def create_transaction(node, coinbase, to_address, amount, expiry_height): tx = CTransaction() # Set the expiry height - f = cStringIO.StringIO(unhexlify(rawtx)) + f = io.BytesIO(unhexlify(rawtx)) tx.deserialize(f) tx.nExpiryHeight = expiry_height rawtx = hexlify(tx.serialize()) signresult = node.signrawtransaction(rawtx) - f = cStringIO.StringIO(unhexlify(signresult['hex'])) + f = io.BytesIO(unhexlify(signresult['hex'])) tx.deserialize(f) tx.rehash() return tx