Skip to content

Commit 1b89ea6

Browse files
committed
pytest: avoid bad gossip flake in test_htlc_no_force_close
l3 closes with l2 unilaterally, but l2 sends l1 the channel_announce after that, when it has never seen it before. The solution is to wait until l1 has seen the channel before we start the rest of the test: ``` E ValueError: E Node errors: E - lightningd-2: had warning messages E - lightningd-1: had bad gossip messages ... lightningd-2 2025-07-09T07:55:59.778Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_in WIRE_WARNING lightningd-2 2025-07-09T07:55:59.778Z INFO 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: Received WIRE_WARNING: WARNING: channel_announcement: no unspent txout 103x1x0 lightningd-1 2025-07-09T07:55:59.781Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#1: billboard: Channel ready for use. lightningd-1 2025-07-09T07:55:59.782Z TRACE gossipd: channel_announcement: got reply for 103x1x0... lightningd-1 2025-07-09T07:55:59.782Z TRACE 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: Bad gossip order: channel_announcement: no unspent txout 103x1x0 ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 44ed1bc commit 1b89ea6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_closing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3882,7 +3882,7 @@ def test_htlc_no_force_close(node_factory, bitcoind, anchors):
38823882
for opt in opts:
38833883
opt['dev-force-features'] = "-23"
38843884

3885-
l1, l2, l3 = node_factory.line_graph(3, opts=opts)
3885+
l1, l2, l3 = node_factory.line_graph(3, opts=opts, wait_for_announce=True)
38863886

38873887
MSATS = 12300000
38883888
inv = l3.rpc.invoice(MSATS, 'label', 'description')
@@ -3911,11 +3911,11 @@ def censoring_sendrawtx(r):
39113911
# l3 gets upset, drops to chain when there are < 4 blocks remaining.
39123912
# But tx doesn't get mined...
39133913
bitcoind.generate_block(8)
3914-
l3.daemon.wait_for_log("Peer permanent failure in CHANNELD_NORMAL: Fulfilled HTLC 0 SENT_REMOVE_.* cltv 114 hit deadline")
3914+
l3.daemon.wait_for_log("Peer permanent failure in CHANNELD_NORMAL: Fulfilled HTLC 0 SENT_REMOVE_.* cltv 119 hit deadline")
39153915

39163916
# l2 closes drops the commitment tx at block 115 (one block after timeout)
39173917
bitcoind.generate_block(4)
3918-
l2.daemon.wait_for_log("Peer permanent failure in CHANNELD_NORMAL: Offered HTLC 0 SENT_ADD_ACK_REVOCATION cltv 114 hit deadline")
3918+
l2.daemon.wait_for_log("Peer permanent failure in CHANNELD_NORMAL: Offered HTLC 0 SENT_ADD_ACK_REVOCATION cltv 119 hit deadline")
39193919
l1.set_feerates((15000, 15000, 15000, 15000))
39203920

39213921
# Two more blocks, with no htlc tx.
@@ -3926,7 +3926,7 @@ def censoring_sendrawtx(r):
39263926
bitcoind.generate_block(1, needfeerate=9999999)
39273927

39283928
# l2 will have abandoned l2->l3 HTLC to close l1->l2.
3929-
l2.daemon.wait_for_log(r'Abandoning unresolved onchain HTLC at block 117 \(expired at 114\) to avoid peer closing incoming HTLC at block 120')
3929+
l2.daemon.wait_for_log(r'Abandoning unresolved onchain HTLC at block 122 \(expired at 119\) to avoid peer closing incoming HTLC at block 125')
39303930

39313931
# l1 should not have force-closed, htlc should be finished by l2.
39323932
assert not l1.daemon.is_in_log('Peer permanent failure in CHANNELD_NORMAL')

0 commit comments

Comments
 (0)