pytest: prepare sql test for faster gossip generation.

Mining 13 blocks to close the l1->l2 channel also causes the l2->l3
channel to confirm, and I was reliably getting the
channel_announcement to l3 in time to confuse this wait_for test.  So
query the channel we want directly to make it more robust.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-01-30 04:52:12 +10:30
parent a27bbbb734
commit 9d9c30331a

View file

@ -4125,8 +4125,8 @@ def test_sql(node_factory, bitcoind):
# This has to wait for the hold_invoice plugin to let go!
txid = l1.rpc.close(l2.info['id'])['txid']
bitcoind.generate_block(13, wait_for_mempool=txid)
wait_for(lambda: len(l3.rpc.listchannels()['channels']) == 2)
assert len(l3.rpc.sql("SELECT * FROM channels;")['rows']) == 2
wait_for(lambda: len(l3.rpc.listchannels(source=l1.info['id'])['channels']) == 0)
assert len(l3.rpc.sql("SELECT * FROM channels WHERE source = X'{}';".format(l1.info['id']))['rows']) == 0
l3.daemon.wait_for_log("Deleting channel: {}".format(scid))
# No deprecated fields!