Skip to content

Commit 2591ac4

Browse files
committed
pytest: add test that we notice height change of sendpsbt with no change.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 5a530e6 commit 2591ac4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_wallet.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,35 @@ def test_onchain_missing_no_p2tr_migrate(node_factory, bitcoind):
18871887
l2.daemon.wait_for_log('Rescan finished! 1 outputs recovered')
18881888

18891889

1890+
@pytest.mark.xfail(strict=True)
1891+
@pytest.mark.parametrize("restart", [False, True])
1892+
def test_sendpsbt_confirm(node_factory, bitcoind, restart):
1893+
"""We should see our sendpsbt in wallet, and that it gets confirmed"""
1894+
l1, l2 = node_factory.get_nodes(2)
1895+
l1.fundwallet(100000)
1896+
1897+
psbt = l1.rpc.fundpsbt(satoshi=10000,
1898+
feerate=7500,
1899+
startweight=42)['psbt']
1900+
psbt = l2.rpc.addpsbtoutput(10000, psbt)['psbt']
1901+
psbt = l1.rpc.signpsbt(psbt)['signed_psbt']
1902+
sent = l1.rpc.sendpsbt(psbt)
1903+
1904+
# Unconfirmed
1905+
lt = only_one([t for t in l1.rpc.listtransactions()['transactions'] if t['rawtx'] == sent['tx']])
1906+
assert lt['blockheight'] == 0
1907+
1908+
if restart:
1909+
l1.restart()
1910+
1911+
bitcoind.generate_block(1, wait_for_mempool=sent['txid'])
1912+
sync_blockheight(bitcoind, [l1])
1913+
1914+
# Should be confirmed now!
1915+
lt = only_one([t for t in l1.rpc.listtransactions()['transactions'] if t['rawtx'] == sent['tx']])
1916+
assert lt['blockheight'] == bitcoind.rpc.getblockcount()
1917+
1918+
18901919
def test_old_htlcs_cleanup(node_factory, bitcoind):
18911920
"""We lazily delete htlcs from channel_htlcs table"""
18921921
l1, l2 = node_factory.line_graph(2)

0 commit comments

Comments
 (0)