Skip to content

Commit a12c02b

Browse files
rustyrussellShahanaFarooqui
authored andcommitted
pytest: fix race in test_zeroconf_forget
fundwallet() actually mines a block, putting our count out. If we see both blocks at once, we will say "52" blocks instead of "51": ``` 2025-05-02T05:28:40.5315155Z have_forgotten = l2.daemon.is_in_log( 2025-05-02T05:28:40.5315650Z r"UNUSUAL {}-chan#1: Forgetting channel: It has been 51 blocks without the funding transaction ".format(l1.info['id']) 2025-05-02T05:28:40.5316105Z ) 2025-05-02T05:28:40.5316263Z 2025-05-02T05:28:40.5316417Z if dopay: 2025-05-02T05:28:40.5316616Z assert not have_forgotten 2025-05-02T05:28:40.5317056Z assert set([c['peer_id'] for c in l2.rpc.listpeerchannels()["channels"]]) == set([l1.info['id'], l3.info['id']]) 2025-05-02T05:28:40.5317477Z else: 2025-05-02T05:28:40.5317662Z > assert have_forgotten 2025-05-02T05:28:40.5317887Z E assert None ``` ``` 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Forgetting channel: It has been 52 blocks without the funding transaction 0bb0579df6b1d983dda49dad47513afc71696c9d5bea3c8b955ba4b76bb053de getting deeply confirmed. We are fundee and can forget channel without loss of funds. ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 5778083 commit a12c02b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_opening.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,8 +2718,10 @@ def censoring_sendrawtx(tx):
27182718

27192719
l1.daemon.rpcproxy.mock_rpc("sendrawtransaction", censoring_sendrawtx)
27202720

2721-
l1.connect(l2)
27222721
l1.fundwallet(10**7)
2722+
l3.fundwallet(10**7)
2723+
2724+
l1.connect(l2)
27232725
l1.rpc.fundchannel(l2.info["id"], 10**6, mindepth=0)
27242726
sync_blockheight(bitcoind, [l1, l2])
27252727
wait_for(lambda: l2.rpc.listincoming()["incoming"] != [])
@@ -2736,7 +2738,6 @@ def censoring_sendrawtx(tx):
27362738

27372739
# We need *another* channel to make it forget the first though!
27382740
l3.connect(l2)
2739-
l3.fundwallet(10**7)
27402741
l3.rpc.fundchannel(l2.info["id"], 10**6, mindepth=0)
27412742
bitcoind.generate_block(1)
27422743

0 commit comments

Comments
 (0)