graph/db: thread context through FetchChannelEdgesByOutpoint

This commit is contained in:
Elle Mouton committed 2026-02-25 16:11:29 +02:00
1 parent 6bbb9a32fc
commit 1d4c6aadb4
10 files changed
+33 -19

No files matched your search

+4 -1
View File
@@ -1,6 +1,7 @@
package netann
import (
"context"
"errors"
"sync"
"time"
@@ -654,7 +655,9 @@ func (m *ChanStatusManager) fetchLastChanUpdateByOutPoint(op wire.OutPoint) (
*lnwire.ChannelUpdate1, bool, error) {
// Get the edge info and policies for this channel from the graph.
info, edge1, edge2, err := m.cfg.Graph.FetchChannelEdgesByOutpoint(&op)
info, edge1, edge2, err := m.cfg.Graph.FetchChannelEdgesByOutpoint(
context.TODO(), &op,
)
if err != nil {
return nil, false, err
}
+3 -1
View File
@@ -2,6 +2,7 @@ package netann_test
import (
"bytes"
"context"
"crypto/rand"
"encoding/binary"
"fmt"
@@ -173,7 +174,8 @@ func (g *mockGraph) FetchAllOpenChannels() ([]*channeldb.OpenChannel, error) {
}
func (g *mockGraph) FetchChannelEdgesByOutpoint(
op *wire.OutPoint) (*models.ChannelEdgeInfo,
_ context.Context, op *wire.OutPoint) (
*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy, *models.ChannelEdgePolicy, error) {
g.mu.Lock()
+5 -2
View File
@@ -1,6 +1,8 @@
package netann
import (
"context"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/graph/db/models"
@@ -19,6 +21,7 @@ type DB interface {
type ChannelGraph interface {
// FetchChannelEdgesByOutpoint returns the channel edge info and most
// recent channel edge policies for a given outpoint.
FetchChannelEdgesByOutpoint(*wire.OutPoint) (*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy, *models.ChannelEdgePolicy, error)
FetchChannelEdgesByOutpoint(context.Context, *wire.OutPoint) (
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
*models.ChannelEdgePolicy, error)
}