Fix latency spike when old high-traffic channels close.#8563
Merged
rustyrussell merged 3 commits intoElementsProject:masterfrom Oct 2, 2025
Merged
Fix latency spike when old high-traffic channels close.#8563rustyrussell merged 3 commits intoElementsProject:masterfrom
rustyrussell merged 3 commits intoElementsProject:masterfrom
Conversation
3eba8a0 to
d2c056b
Compare
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
d2c056b to
fa16b1e
Compare
…it for restart. Signed-off-by: Rusty Russell <[email protected]>
fa16b1e to
4707f41
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #7962