Merge pull request #10610 from ellemouton/graph-cleanup-todo-contexts
graph/db+refactor: surface all `context.TODO()`s
This commit is contained in:
31 files changed
+642
-484
No files matched your search
@@ -522,8 +522,16 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
|
||||
//nolint:ll
|
||||
paths, err := blindedpath.BuildBlindedPaymentPaths(
|
||||
&blindedpath.BuildBlindedPathCfg{
|
||||
FindRoutes: cfg.QueryBlindedRoutes,
|
||||
FetchChannelEdgesByID: cfg.Graph.FetchChannelEdgesByID,
|
||||
FindRoutes: cfg.QueryBlindedRoutes,
|
||||
FetchChannelEdgesByID: func(chanID uint64) (
|
||||
*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy,
|
||||
*models.ChannelEdgePolicy, error) {
|
||||
|
||||
return cfg.Graph.FetchChannelEdgesByID(
|
||||
context.TODO(), chanID,
|
||||
)
|
||||
},
|
||||
FetchOurOpenChannels: cfg.ChanDB.FetchAllOpenChannels,
|
||||
PathID: paymentAddr[:],
|
||||
ValueMsat: invoice.Value,
|
||||
@@ -787,12 +795,23 @@ func newSelectHopHintsCfg(invoicesCfg *AddInvoiceConfig,
|
||||
maxHopHints int) *SelectHopHintsCfg {
|
||||
|
||||
return &SelectHopHintsCfg{
|
||||
FetchAllChannels: invoicesCfg.ChanDB.FetchAllChannels,
|
||||
IsChannelActive: invoicesCfg.IsChannelActive,
|
||||
IsPublicNode: invoicesCfg.Graph.IsPublicNode,
|
||||
FetchChannelEdgesByID: invoicesCfg.Graph.FetchChannelEdgesByID,
|
||||
GetAlias: invoicesCfg.GetAlias,
|
||||
MaxHopHints: maxHopHints,
|
||||
FetchAllChannels: invoicesCfg.ChanDB.FetchAllChannels,
|
||||
IsChannelActive: invoicesCfg.IsChannelActive,
|
||||
IsPublicNode: func(pubKey [33]byte) (bool, error) {
|
||||
return invoicesCfg.Graph.IsPublicNode(
|
||||
context.TODO(), pubKey,
|
||||
)
|
||||
},
|
||||
FetchChannelEdgesByID: func(chanID uint64) (
|
||||
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
|
||||
*models.ChannelEdgePolicy, error) {
|
||||
|
||||
return invoicesCfg.Graph.FetchChannelEdgesByID(
|
||||
context.TODO(), chanID,
|
||||
)
|
||||
},
|
||||
GetAlias: invoicesCfg.GetAlias,
|
||||
MaxHopHints: maxHopHints,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package invoicesrpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||
)
|
||||
|
||||
@@ -9,11 +11,12 @@ type GraphSource interface {
|
||||
// FetchChannelEdgesByID attempts to look up the two directed edges for
|
||||
// the channel identified by the channel ID. If the channel can't be
|
||||
// found, then graphdb.ErrEdgeNotFound is returned.
|
||||
FetchChannelEdgesByID(chanID uint64) (*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy, *models.ChannelEdgePolicy, error)
|
||||
FetchChannelEdgesByID(ctx context.Context, chanID uint64) (
|
||||
*models.ChannelEdgeInfo, *models.ChannelEdgePolicy,
|
||||
*models.ChannelEdgePolicy, error)
|
||||
|
||||
// IsPublicNode is a helper method that determines whether the node with
|
||||
// the given public key is seen as a public node in the graph from the
|
||||
// graph's source node's point of view.
|
||||
IsPublicNode(pubKey [33]byte) (bool, error)
|
||||
IsPublicNode(ctx context.Context, pubKey [33]byte) (bool, error)
|
||||
}
|
||||
Reference in new issue
Block a user