mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
wallet: clean reserved inputs on startup.
We reserve inputs when we're going to send a transaction, but we don't unreserve them if we crash. This is most graphically demonstrated by the txprepare case, which makes it easier to trigger. Instead, we should query bitcoind to see whether the tx made it out or not, as we would do manually with dev-rescan-outputs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -323,7 +323,6 @@ def test_txsend(node_factory, bitcoind):
|
||||
assert decode['vout'][changenum]['scriptPubKey']['addresses'][0] in [f['address'] for f in l1.rpc.listfunds()['outputs']]
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_txprepare_restart(node_factory, bitcoind):
|
||||
amount = 1000000
|
||||
l1 = node_factory.get_node(may_fail=True)
|
||||
@@ -367,6 +366,10 @@ def test_txprepare_restart(node_factory, bitcoind):
|
||||
# It goes backwards in blockchain just in case there was a reorg. Wait.
|
||||
wait_for(lambda: [o['status'] for o in l1.rpc.listfunds()['outputs']] == ['confirmed'] * 10)
|
||||
|
||||
# It should have logged this for each output.
|
||||
for i in decode['vin']:
|
||||
assert l1.daemon.is_in_log('wallet: reserved output {}/{} reset to available'.format(i['txid'], i['vout']))
|
||||
|
||||
prep = l1.rpc.txprepare('bcrt1qeyyk6sl5pr49ycpqyckvmttus5ttj25pd0zpvg',
|
||||
'all')
|
||||
decode = bitcoind.rpc.decoderawtransaction(prep['unsigned_tx'])
|
||||
|
||||
Reference in New Issue
Block a user