Browse Source

pytest: test txprepare with unconfirmed utxos

travis-debug
darosior 5 years ago
committed by Christian Decker
parent
commit
9e9e23c81a
  1. 10
      tests/test_wallet.py

10
tests/test_wallet.py

@ -280,6 +280,7 @@ def test_txprepare_multi(node_factory, bitcoind):
l1.rpc.txdiscard(prep['txid']) l1.rpc.txdiscard(prep['txid'])
@pytest.mark.xfail(strict=True)
def test_txprepare(node_factory, bitcoind, chainparams): def test_txprepare(node_factory, bitcoind, chainparams):
amount = 1000000 amount = 1000000
l1 = node_factory.get_node(random_hsm=True) l1 = node_factory.get_node(random_hsm=True)
@ -366,11 +367,16 @@ def test_txprepare(node_factory, bitcoind, chainparams):
l1.rpc.txdiscard(prep4['txid']) l1.rpc.txdiscard(prep4['txid'])
# Try passing in a utxo set # Try passing in a utxo set
utxos = [utxo["txid"] + ":" + str(utxo["output"]) for utxo in l1.rpc.listfunds()["outputs"]][:4] utxos = [utxo["txid"] + ":" + str(utxo["output"])
for utxo in l1.rpc.listfunds()["outputs"]][:4]
prep5 = l1.rpc.txprepare([{addr: prep5 = l1.rpc.txprepare([{addr:
Millisatoshi(amount * 3.5 * 1000)}], utxos=utxos) Millisatoshi(amount * 3.5 * 1000)}], utxos=utxos)
# Try passing unconfirmed utxos
unconfirmed_utxo = l1.rpc.withdraw(l1.rpc.newaddr()["bech32"], 10**5)
utxos = [unconfirmed_utxo["txid"] + ":0"]
l1.rpc.txprepare([{addr: Millisatoshi(amount * 3.5 * 1000)}], utxos=utxos)
decode = bitcoind.rpc.decoderawtransaction(prep5['unsigned_tx']) decode = bitcoind.rpc.decoderawtransaction(prep5['unsigned_tx'])
assert decode['txid'] == prep5['txid'] assert decode['txid'] == prep5['txid']

Loading…
Cancel
Save