Skip to content

Commit c862330

Browse files
committed
pytest: correct wallet test already fixed.
1c5e632 (fix: release txprepare reservations on send failure) actually fixed this case, but due to the CI rush somehow it got though. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent bd71651 commit c862330

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

tests/test_wallet.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,24 +2971,9 @@ def mock_fail_sendrawtx(r):
29712971
with pytest.raises(RpcError, match=r'Error broadcasting transaction'):
29722972
l1.rpc.withdraw(waddr, 'all')
29732973

2974-
# BUG: UTXOs remain reserved despite the failed broadcast.
2975-
# sendpsbt_done correctly unreserves the reservation it added (72 blocks),
2976-
# but fundpsbt's prior reservation (72 blocks) is NOT cleaned up.
29772974
outputs = l1.rpc.listfunds()['outputs']
29782975
reserved = [o for o in outputs if o.get('reserved', False)]
2979-
assert len(reserved) > 0, \
2980-
"Expected UTXOs to be reserved after failed broadcast (known bug)"
2981-
2982-
with pytest.raises(RpcError, match=r'Could not afford'):
2983-
l1.rpc.withdraw(waddr, 'all')
2984-
2985-
# Workaround: build a PSBT from the stuck UTXOs and call unreserveinputs.
2986-
stuck_utxos = [{'txid': o['txid'], 'vout': o['output']} for o in reserved]
2987-
psbt = bitcoind.rpc.createpsbt(stuck_utxos, [])
2988-
l1.rpc.unreserveinputs(psbt)
2989-
2990-
outputs = l1.rpc.listfunds()['outputs']
2991-
assert not any(o.get('reserved', False) for o in outputs)
2976+
assert reserved == []
29922977

29932978
l1.rpc.withdraw(waddr, 'all')
29942979
bitcoind.generate_block(1)

0 commit comments

Comments
 (0)