graph/db: thread context through FilterChannelRange

This commit is contained in:
Elle Mouton committed 2026-02-25 15:33:34 +02:00
1 parent e8e714f6a3
commit bb38aa8922
6 files changed
+16 -13

No files matched your search

+1 -1
View File
@@ -241,7 +241,7 @@ func (c *ChanSeries) FilterChannelRange(_ chainhash.Hash, startHeight,
error) {
return c.graph.FilterChannelRange(
startHeight, endHeight, withTimestamps,
context.TODO(), startHeight, endHeight, withTimestamps,
)
}
+6 -3
View File
@@ -711,10 +711,13 @@ func (c *ChannelGraph) ChanUpdatesInHorizon(ctx context.Context,
}
// FilterChannelRange returns channel IDs within the passed block height range.
func (c *ChannelGraph) FilterChannelRange(startHeight, endHeight uint32,
withTimestamps bool) ([]BlockChannelRange, error) {
func (c *ChannelGraph) FilterChannelRange(ctx context.Context,
startHeight, endHeight uint32, withTimestamps bool) (
[]BlockChannelRange, error) {
return c.db.FilterChannelRange(startHeight, endHeight, withTimestamps)
return c.db.FilterChannelRange(
ctx, startHeight, endHeight, withTimestamps,
)
}
// FetchChanInfos returns the set of channel edges for the passed channel IDs.
+3 -3
View File
@@ -3477,7 +3477,7 @@ func TestFilterChannelRange(t *testing.T) {
// If we try to filter a channel range before we have any channels
// inserted, we should get an empty slice of results.
resp, err := graph.FilterChannelRange(10, 100, false)
resp, err := graph.FilterChannelRange(ctx, 10, 100, false)
require.NoError(t, err)
require.Empty(t, resp)
@@ -3652,7 +3652,7 @@ func TestFilterChannelRange(t *testing.T) {
// First, do the query without requesting timestamps.
resp, err := graph.FilterChannelRange(
test.startHeight, test.endHeight, false,
ctx, test.startHeight, test.endHeight, false,
)
require.NoError(t, err)
@@ -3666,7 +3666,7 @@ func TestFilterChannelRange(t *testing.T) {
// Now, query the timestamps as well.
resp, err = graph.FilterChannelRange(
test.startHeight, test.endHeight, true,
ctx, test.startHeight, test.endHeight, true,
)
require.NoError(t, err)
+3 -2
View File
@@ -277,8 +277,9 @@ type Store interface { //nolint:interfacebloat
// offline. If withTimestamps is true then the timestamp info of the
// latest received channel update messages of the channel will be
// included in the response.
FilterChannelRange(startHeight, endHeight uint32, withTimestamps bool) (
[]BlockChannelRange, error)
FilterChannelRange(ctx context.Context, startHeight,
endHeight uint32,
withTimestamps bool) ([]BlockChannelRange, error)
// FetchChanInfos returns the set of channel edges that correspond to
// the passed channel ID's. If an edge is the query is unknown to the
+1 -1
View File
@@ -2817,7 +2817,7 @@ type BlockChannelRange struct {
// up after a period of time offline. If withTimestamps is true then the
// timestamp info of the latest received channel update messages of the channel
// will be included in the response.
func (c *KVStore) FilterChannelRange(startHeight,
func (c *KVStore) FilterChannelRange(_ context.Context, startHeight,
endHeight uint32, withTimestamps bool) ([]BlockChannelRange, error) {
startChanID := &lnwire.ShortChannelID{
+2 -3
View File
@@ -1664,11 +1664,10 @@ func (s *SQLStore) ForEachChannel(ctx context.Context,
// will be included in the response.
//
// NOTE: This is part of the Store interface.
func (s *SQLStore) FilterChannelRange(startHeight, endHeight uint32,
withTimestamps bool) ([]BlockChannelRange, error) {
func (s *SQLStore) FilterChannelRange(ctx context.Context, startHeight,
endHeight uint32, withTimestamps bool) ([]BlockChannelRange, error) {
var (
ctx = context.TODO()
startSCID = &lnwire.ShortChannelID{
BlockHeight: startHeight,
}