-
Notifications
You must be signed in to change notification settings - Fork 2.2k
multi: make gossip filter sends non-blocking, only allow a single backlog catch up goroutine per peer #10097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yyforyongyu
merged 8 commits into
lightningnetwork:master
from
Roasbeef:gossip-block-fix
Aug 4, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
694cc15
discovery: make gossip filter semaphore capacity configurable
Roasbeef 7fb289f
discovery: add async timestamp range queue to prevent blocking
Roasbeef f3ba372
discovery: integrate async queue in ProcessRemoteAnnouncement
Roasbeef 7f16b24
multi: wire up gossip filter concurrency config
Roasbeef ed717a1
docs: add comprehensive gossip rate limiting guide
Roasbeef 5fcd33c
discovery: add tests for for async timestamp range queue
Roasbeef 7e767ea
discovery: only permit a single gossip backlog goroutine per peer
Roasbeef 8dcb7a8
docs/release-notes: add release notes entry
Roasbeef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,9 @@ const ( | |
// network as possible. | ||
DefaultHistoricalSyncInterval = time.Hour | ||
|
||
// filterSemaSize is the capacity of gossipFilterSema. | ||
filterSemaSize = 5 | ||
// DefaultFilterConcurrency is the default maximum number of concurrent | ||
// gossip filter applications that can be processed. | ||
Roasbeef marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DefaultFilterConcurrency = 5 | ||
|
||
// DefaultMsgBytesBurst is the allotted burst in bytes we'll permit. | ||
// This is the most that can be sent in a given go. Requests beyond | ||
|
@@ -136,6 +137,10 @@ type SyncManagerCfg struct { | |
// AllotedMsgBytesBurst is the amount of burst bytes we'll permit, if | ||
// we've exceeded the hard upper limit. | ||
AllotedMsgBytesBurst uint64 | ||
|
||
// FilterConcurrency is the maximum number of concurrent gossip filter | ||
// applications that can be processed. If not set, defaults to 5. | ||
FilterConcurrency int | ||
yyforyongyu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// SyncManager is a subsystem of the gossiper that manages the gossip syncers | ||
|
@@ -207,8 +212,13 @@ type SyncManager struct { | |
// newSyncManager constructs a new SyncManager backed by the given config. | ||
func newSyncManager(cfg *SyncManagerCfg) *SyncManager { | ||
|
||
filterSema := make(chan struct{}, filterSemaSize) | ||
for i := 0; i < filterSemaSize; i++ { | ||
filterConcurrency := cfg.FilterConcurrency | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: newline above |
||
if filterConcurrency == 0 { | ||
filterConcurrency = DefaultFilterConcurrency | ||
} | ||
|
||
filterSema := make(chan struct{}, filterConcurrency) | ||
for i := 0; i < filterConcurrency; i++ { | ||
filterSema <- struct{}{} | ||
} | ||
|
||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.