Skip to content

Conversation

rustyrussell
Copy link
Contributor

Fixes: #7962

@rustyrussell rustyrussell added this to the v25.12 milestone Sep 22, 2025
@madelinevibes madelinevibes added the 25.09.1 Point release for 25.09 label Sep 25, 2025
@rustyrussell rustyrussell force-pushed the guilt/closing-stress branch 3 times, most recently from 3eba8a0 to d2c056b Compare October 1, 2025 02:43
This doesn't happen yet, since we delete all HTLCs when we close a channel.  But we're
about to change that, so update the wallet_htlcs_first() code to avoid them.

Signed-off-by: Rusty Russell <[email protected]>
…rtup.

For old channels, this can take a while, and it stops everything.  But
we are only doing this to save space; it's not a *functional* necessity.

A quick and dirty test with 50,000 htlcs shows the htlc deletion took
450msec.  I tried adding an index, and changing it to set hstate to
HTLC_STATE_INVALID instead of deleting entries, but it still took about 350ms.

Whereas the "COUNT(*)" only took 1.7msec, so it's worth keeping.

Reported-by: @michael1011
Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: lightningd: we defer deletion of old htlcs on channel close, to avoid pausing for a long time (we clean them on startup)
Fixes: ElementsProject#7962
@rustyrussell rustyrussell merged commit aa8d858 into ElementsProject:master Oct 2, 2025
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
25.09.1 Point release for 25.09
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hiccups when closed channels are being forgotten
2 participants