discovery: account for future gossip memory - #11158
Open
moscowchill wants to merge 2 commits into
Open
Conversation
Future gossip entries currently have a constant cache cost even when a decoded channel announcement retains a dense feature map. Charge a maximum wire body per message plus each decoded feature-map entry, preserving the ordinary message count while bounding dense retained state. Signed-off-by: moscowchill <gasgeverij@proton.me>
Signed-off-by: moscowchill <gasgeverij@proton.me>
moscowchill
marked this pull request as ready for review
September 1, 2026 18:22
🟠 PR Severity: HIGH
🟠 High (1 file)
🟢 Low (2 files)
AnalysisThe core change is in To override, add a |
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.
Change Description
The future gossip cache currently charges each decoded message as one unit. A
ChannelAnnouncement1feature vector can decode into 65,536 map entries, so the existing 1,000-message limit does not bound the memory retained by the cache.This PR converts the cache to a retained-memory budget while preserving the existing upper bound of 1,000 ordinary messages. Every future message receives a conservative maximum-wire-body charge, and decoded channel-announcement feature entries receive an additional per-entry charge. A maximally dense announcement therefore consumes 1,114,109 cache bytes and the production cache retains at most 58 such objects.
Validation order, replay behavior, and monotonic cache keys remain unchanged. The change is scoped to bounding retained cache state; transient decoding work remains subject to the existing gossip processing limits.
Steps to Test
Pull Request Checklist
Testing
Code Style and Documentation