From f2e7e9d919c1670b6bdfd3e672d476988951d43b Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 14 Jul 2022 22:53:46 -0500 Subject: [PATCH] coin-moves: only log htlc_timeout pair for penalty txs We cleanup our output tracking for timeout txs when the peer's htlc_timeout self-expiry is hit; we'd also log its spend if happen to see it get spent. This is a bit of a race as they can't spend it until the locktime is available. Hence the flakiness in tests that expected the `htlc_timeout` to *not* be spent. Instead, we only log an external's `htlc_timeout` spend in the case where we also immediately register another output to track for it (only happens when said htlc is stealable) Fixes #5405 In-Collab-With: @ddustin --- onchaind/onchaind.c | 10 +++++----- tests/test_closing.py | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index 6859d327d..6c7049a42 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -1727,12 +1727,12 @@ static void output_spent(struct tracked_output ***outs, break; case THEIR_HTLC: - record_external_deposit(out, out->tx_blockheight, - HTLC_TIMEOUT); - record_external_spend(&tx_parts->txid, out, - tx_blockheight, HTLC_TIMEOUT); - if (out->tx_type == THEIR_REVOKED_UNILATERAL) { + record_external_deposit(out, out->tx_blockheight, + HTLC_TIMEOUT); + record_external_spend(&tx_parts->txid, out, + tx_blockheight, HTLC_TIMEOUT); + /* we've actually got a 'new' output here */ steal_htlc_tx(out, outs, tx_parts, tx_blockheight, diff --git a/tests/test_closing.py b/tests/test_closing.py index 70b989987..4cc07dea4 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -2520,7 +2520,6 @@ def test_onchain_feechange(node_factory, bitcoind, executor): assert only_one(l2.rpc.listinvoices('onchain_timeout')['invoices'])['status'] == 'unpaid' -@pytest.mark.skip("Lisa, please fix this!") @pytest.mark.developer("needs DEVELOPER=1 for dev-set-fees") def test_onchain_all_dust(node_factory, bitcoind, executor): """Onchain handling when we reduce output to all dust"""