Update to py3, ISSUE with encoding in create_block

This commit is contained in:
mdr0id 2019-12-04 08:08:23 -08:00
parent 344ea4433b
commit 57ec715d4c
1 changed files with 5 additions and 7 deletions

View File

@ -1,11 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
#
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import start_nodes
from test_framework.mininode import CTransaction, NetworkThread
@ -13,7 +11,7 @@ from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.script import CScript
from binascii import unhexlify
import cStringIO
import io
'''
@ -49,7 +47,7 @@ class BIP66Test(ComparisonTestFramework):
rawtx = node.createrawtransaction(inputs, outputs)
signresult = node.signrawtransaction(rawtx)
tx = CTransaction()
f = cStringIO.StringIO(unhexlify(signresult['hex']))
f = io.StringIO(unhexlify(signresult['hex']))
tx.deserialize(f)
return tx
@ -74,8 +72,8 @@ class BIP66Test(ComparisonTestFramework):
self.coinbase_blocks = self.nodes[0].generate(1)
self.nodes[0].generate(100)
hashTip = self.nodes[0].getbestblockhash()
hashFinalSaplingRoot = int("0x" + self.nodes[0].getblock(hashTip)['finalsaplingroot'] + "L", 0)
self.tip = int ("0x" + hashTip + "L", 0)
hashFinalSaplingRoot = int("0x" + self.nodes[0].getblock(hashTip)['finalsaplingroot'], 0)
self.tip = int (hashTip , 0)
self.nodeaddress = self.nodes[0].getnewaddress()
'''Check that the rules are enforced.'''