From 29bf5151f1dd35f308b7d7f413c48158ca00ffd0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 10 Jul 2023 15:36:49 +0930 Subject: [PATCH] pytest: fix flake in test_closing_anchorspend_htlc_tx_rbf Turns out we resubmit two txs (the commitment tx, and the anchor spend), but only wait for one of them: if we mine a block before the anchor spend, it doesn't go in: ``` @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd anchors unsupported') @pytest.mark.developer("needs dev_disconnect") def test_closing_anchorspend_htlc_tx_rbf(node_factory, bitcoind): ... l1.daemon.wait_for_log('Peer permanent failure in CHANNELD_NORMAL: Offered HTLC 0 SENT_ADD_ACK_REVOCATION cltv 116 hit deadline') l1.daemon.wait_for_log('Creating anchor spend for CPFP') wait_for(lambda: len(bitcoind.rpc.getrawmempool()) == 2) # But we don't mine it! And fees go up again! l1.set_feerates((3000, 3000, 3000, 3000)) bitcoind.generate_block(1, needfeerate=5000) l1.daemon.wait_for_log('RBF anchor spend') l1.daemon.wait_for_log('sendrawtx exit 0') # And now we'll get it in (there's some rounding, so feerate a bit lower!) bitcoind.generate_block(1, needfeerate=2990) > wait_for(lambda: 'ONCHAIN:Tracking our own unilateral close' in only_one(l1.rpc.listpeerchannels()['channels'])['status']) ``` --- tests/test_closing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_closing.py b/tests/test_closing.py index b66028b03..0f4f23f62 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -3775,7 +3775,8 @@ def test_closing_anchorspend_htlc_tx_rbf(node_factory, bitcoind): bitcoind.generate_block(1, needfeerate=5000) l1.daemon.wait_for_log('RBF anchor spend') - l1.daemon.wait_for_log('sendrawtx exit 0') + # We actually resubmit the commit tx, then the RBF: + l1.daemon.wait_for_logs(['sendrawtx exit 0'] * 2) # And now we'll get it in (there's some rounding, so feerate a bit lower!) bitcoind.generate_block(1, needfeerate=2990)