-
Notifications
You must be signed in to change notification settings - Fork 2.2k
multi: update ChanUpdatesInHorizon and NodeUpdatesInHorizon to return iterators (iter.Seq[T]) #10128
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
Roasbeef
merged 13 commits into
lightningnetwork:master
from
Roasbeef:iter-chan-updates
Sep 27, 2025
Merged
multi: update ChanUpdatesInHorizon and NodeUpdatesInHorizon to return iterators (iter.Seq[T]) #10128
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
015875e
fn: add Collect+CollertErr function for iterators
Roasbeef f8ce00b
graph/db: add options infrastructure for iterator configuration
Roasbeef 1d6d54e
graph/db: convert NodeUpdatesInHorizon to use iterators
Roasbeef 069888b
graph/db: convert ChanUpdatesInHorizon to use iterators
Roasbeef c69971c
sqldb: implement iterator support for NodeUpdatesInHorizon
Roasbeef 31ab2ae
sqldb: implement iterator support for ChanUpdatesInHorizon
Roasbeef 32528af
graph/db: add tests for iterator implementations
Roasbeef fda989d
discovery+graph: update callers to use new iterator APIs
Roasbeef d8f6fd2
discovery: convert UpdatesInHorizon to return iter.Seq2[lnwire.Messag…
Roasbeef 77f3b35
discovery: update ApplyGossipFilter to use lazy iterator with Pull2
Roasbeef 0b3816a
discovery/test: update mock to support iterator-based UpdatesInHorizon
Roasbeef f3a8fd8
graph+discovery: update graph/db gossip backlog interfaces to use ite…
Roasbeef 506c3d5
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import ( | |
"context" | ||
"errors" | ||
"fmt" | ||
"iter" | ||
"math" | ||
"reflect" | ||
"sort" | ||
|
@@ -86,13 +87,22 @@ func (m *mockChannelGraphTimeSeries) HighestChanID(_ context.Context, | |
} | ||
|
||
func (m *mockChannelGraphTimeSeries) UpdatesInHorizon(chain chainhash.Hash, | ||
startTime time.Time, endTime time.Time) ([]lnwire.Message, error) { | ||
startTime, endTime time.Time) iter.Seq2[lnwire.Message, error] { | ||
|
||
m.horizonReq <- horizonQuery{ | ||
chain, startTime, endTime, | ||
} | ||
return func(yield func(lnwire.Message, error) bool) { | ||
m.horizonReq <- horizonQuery{ | ||
chain, startTime, endTime, | ||
} | ||
|
||
return <-m.horizonResp, nil | ||
// We'll get the response from the channel, then yield it | ||
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. commit message doesnt match the diff 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. Will revisit, had to do a pretty gnarly rebase to got all the commits compiling lol. |
||
// immediately. | ||
msgs := <-m.horizonResp | ||
for _, msg := range msgs { | ||
if !yield(msg, nil) { | ||
return | ||
} | ||
} | ||
} | ||
} | ||
|
||
func (m *mockChannelGraphTimeSeries) FilterKnownChanIDs(chain chainhash.Hash, | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/lightningnetwork/lnd/fn/v2 | ||
|
||
go 1.19 | ||
go 1.23 | ||
|
||
require ( | ||
github.com/stretchr/testify v1.8.1 | ||
|
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.