Changes to match v22 of Bitcoin Core
This commit is contained in:
parent
069526d693
commit
2724b0e55f
@ -1,6 +1,6 @@
|
||||
# (c) Copyright 2020 by Coinkite Inc. This file is covered by license found in COPYING-CC.
|
||||
#
|
||||
# Access a local bitcoin-Qt/bitcoind on testnet
|
||||
# Access a local bitcoin-Qt/bitcoind on testnet (must be v22 or higher)
|
||||
#
|
||||
# Must have these lines in the bitcoin.conf file:
|
||||
#
|
||||
@ -11,7 +11,7 @@ import pytest, os
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy
|
||||
from base64 import b64encode, b64decode
|
||||
|
||||
URL = '127.0.0.1:18332'
|
||||
URL = '127.0.0.1:18332/wallet/'
|
||||
|
||||
def get_cookie():
|
||||
# read local bitcoind cookie .. highly mac-only
|
||||
@ -34,6 +34,7 @@ def bitcoind():
|
||||
conn = AuthServiceProxy('http://' + cookie + '@' + URL)
|
||||
|
||||
assert conn.getblockchaininfo()['chain'] == 'test'
|
||||
assert conn.getnetworkinfo()['version'] >= 220000, "we require >= 22.0 of Core"
|
||||
|
||||
return conn
|
||||
|
||||
|
||||
@ -819,7 +819,7 @@ def check_against_bitcoind(bitcoind, sim_exec, sim_execfile):
|
||||
if dests:
|
||||
# check we got right destination address(es)
|
||||
for outn, expect_addr in dests:
|
||||
assert decode['vout'][outn]['scriptPubKey']['addresses'][0] == expect_addr
|
||||
assert decode['vout'][outn]['scriptPubKey']['address'] == expect_addr
|
||||
|
||||
# leverage bitcoind's transaction decoding
|
||||
ex = dict( lock_time = decode['locktime'],
|
||||
@ -829,7 +829,7 @@ def check_against_bitcoind(bitcoind, sim_exec, sim_execfile):
|
||||
miner_fee = U2SAT(fee),
|
||||
warnings_expected = num_warn,
|
||||
total_value_out = sum(U2SAT(i['value']) for i in decode['vout']),
|
||||
destinations = [(U2SAT(i['value']), i['scriptPubKey']['addresses'][0])
|
||||
destinations = [(U2SAT(i['value']), i['scriptPubKey']['address'])
|
||||
for i in decode['vout']],
|
||||
)
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ def test_io_size(request, decode_with_bitcoind, fake_txn, is_mark3,
|
||||
shown = set()
|
||||
hidden = set()
|
||||
for i in decoded['vout']:
|
||||
dest = i['scriptPubKey']['addresses'][0]
|
||||
dest = i['scriptPubKey']['address']
|
||||
val = i['value']
|
||||
if dest in story:
|
||||
shown.add((val, dest))
|
||||
@ -1292,18 +1292,18 @@ def test_wrong_xfp_multi(fake_txn, try_sign, segwit):
|
||||
# - but multiple wrong XFP values
|
||||
|
||||
wrongs = set()
|
||||
wrong_xfp = b'\x12\x34\x56\x78'
|
||||
|
||||
def hack(psbt):
|
||||
# change all inputs to be "not ours" ... but with utxo details
|
||||
for idx, i in enumerate(psbt.inputs):
|
||||
for pubkey in i.bip32_paths:
|
||||
here = struct.pack('<I', idx)
|
||||
here = struct.pack('<I', idx+73)
|
||||
i.bip32_paths[pubkey] = here + i.bip32_paths[pubkey][4:]
|
||||
wrongs.add(xfp2str(idx))
|
||||
wrongs.add(xfp2str(idx+73))
|
||||
|
||||
psbt = fake_txn(7, 2, segwit_in=segwit, psbt_hacker=hack)
|
||||
|
||||
open('debug/wrong-xfp.psbt', 'wb').write(psbt)
|
||||
with pytest.raises(CCProtoError) as ee:
|
||||
orig, result = try_sign(psbt, accept=True)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user