From 57ec715d4ce4452ef0004ceb66b4601efac5fc37 Mon Sep 17 00:00:00 2001 From: mdr0id Date: Wed, 4 Dec 2019 08:08:23 -0800 Subject: [PATCH] Update to py3, ISSUE with encoding in create_block --- qa/rpc-tests/bipdersig-p2p.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/qa/rpc-tests/bipdersig-p2p.py b/qa/rpc-tests/bipdersig-p2p.py index ab0bed143..05a25c1d7 100755 --- a/qa/rpc-tests/bipdersig-p2p.py +++ b/qa/rpc-tests/bipdersig-p2p.py @@ -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.'''