mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
[qa] Switch to py3
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2014-2016 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -46,7 +46,7 @@ def genmrklroot(leaflist):
|
||||
cur = n
|
||||
return cur[0]
|
||||
|
||||
def template_to_bytes(tmpl, txlist):
|
||||
def template_to_bytearray(tmpl, txlist):
|
||||
blkver = pack('<L', tmpl['version'])
|
||||
mrklroot = genmrklroot(list(dblsha(a) for a in txlist))
|
||||
timestamp = pack('<L', tmpl['curtime'])
|
||||
@@ -55,10 +55,10 @@ def template_to_bytes(tmpl, txlist):
|
||||
blk += varlenEncode(len(txlist))
|
||||
for tx in txlist:
|
||||
blk += tx
|
||||
return blk
|
||||
return bytearray(blk)
|
||||
|
||||
def template_to_hex(tmpl, txlist):
|
||||
return b2x(template_to_bytes(tmpl, txlist))
|
||||
return b2x(template_to_bytearray(tmpl, txlist))
|
||||
|
||||
def assert_template(node, tmpl, txlist, expect):
|
||||
rsp = node.getblocktemplate({'data':template_to_hex(tmpl, txlist),'mode':'proposal'})
|
||||
@@ -129,7 +129,7 @@ class GetBlockTemplateProposalTest(BitcoinTestFramework):
|
||||
tmpl['bits'] = realbits
|
||||
|
||||
# Test 9: Bad merkle root
|
||||
rawtmpl = template_to_bytes(tmpl, txlist)
|
||||
rawtmpl = template_to_bytearray(tmpl, txlist)
|
||||
rawtmpl[4+32] = (rawtmpl[4+32] + 1) % 0x100
|
||||
rsp = node.getblocktemplate({'data':b2x(rawtmpl),'mode':'proposal'})
|
||||
if rsp != 'bad-txnmrklroot':
|
||||
|
||||
Reference in New Issue
Block a user