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
This commit is contained in:
niftynei 2022-07-14 22:53:46 -05:00 committed by Rusty Russell
parent 6fd8fa4d95
commit f2e7e9d919
2 changed files with 5 additions and 6 deletions

View File

@ -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,

View File

@ -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"""