Skip to content

Commit 462e598

Browse files
committed
pytest: generate broken db examples now, before we fix them.
We'll need these for our migration tests, so we need to generate "bad" dbs now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 498c789 commit 462e598

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed
Binary file not shown.
12.5 KB
Binary file not shown.

tests/test_closing.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4042,6 +4042,33 @@ def test_closing_cpfp(node_factory, bitcoind):
40424042
# They should now see a single additional output each
40434043
sync_blockheight(bitcoind, [l1, l2])
40444044
assert len(l1.rpc.listfunds()['outputs']) == 2
4045+
4046+
4047+
@pytest.mark.skip("Solely to generate the blockchain and test dbs, before we fixed output p2pkh watching")
4048+
def test_onchain_p2tr_missed_txs(node_factory, bitcoind):
4049+
"""Creates a blockchain and two nodes which have missed their p2wpkh close outputs: l1 is in state CLOSING_COMPLETE at block 103, so the close is not yet onchain, and l2 is in state CLOSED at block 203, so the close is long-gone."""
4050+
l1, l2, l3 = node_factory.line_graph(3, opts=[{'may_reconnect': True},
4051+
{'may_reconnect': True,
4052+
'dev-force-features': "-27"},
4053+
{'may_reconnect': True}])
4054+
4055+
assert len(l1.rpc.listfunds()['outputs']) == 1
4056+
assert len(l2.rpc.listfunds()['outputs']) == 1
4057+
4058+
l1.restart()
4059+
l1.rpc.close(l2.info['id'])
4060+
l2.restart()
4061+
l2.rpc.close(l3.info['id'])
4062+
wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CLOSINGD_COMPLETE')
4063+
l1.stop()
4064+
4065+
print(f"L1's blockheight = {bitcoind.rpc.getblockcount()}")
4066+
bitcoind.generate_block(100, wait_for_mempool=2)
4067+
wait_for(lambda: l2.rpc.listpeerchannels()['channels'] == [])
4068+
4069+
print(bitcoind.save_blocks())
4070+
# Grab it from the logs.
4071+
assert False
40454072
# This one will also have emergency change if anchors
40464073
if 'anchors/even' in only_one(l1.rpc.listpeerchannels()['channels'])['channel_type']['names']:
40474074
assert len(l2.rpc.listfunds()['outputs']) == 2

tests/test_wallet.py

Lines changed: 19 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)