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