mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
autopilot: update AttachmentHeuristics with context
Continue threading context through the autopilot system and remove the remaining context.TODOs.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package autopilot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
@@ -70,9 +71,9 @@ func (c *WeightedCombAttachment) Name() string {
|
||||
// is the maximum possible improvement in connectivity.
|
||||
//
|
||||
// NOTE: This is a part of the AttachmentHeuristic interface.
|
||||
func (c *WeightedCombAttachment) NodeScores(g ChannelGraph, chans []LocalChannel,
|
||||
chanSize btcutil.Amount, nodes map[NodeID]struct{}) (
|
||||
map[NodeID]*NodeScore, error) {
|
||||
func (c *WeightedCombAttachment) NodeScores(ctx context.Context, g ChannelGraph,
|
||||
chans []LocalChannel, chanSize btcutil.Amount,
|
||||
nodes map[NodeID]struct{}) (map[NodeID]*NodeScore, error) {
|
||||
|
||||
// We now query each heuristic to determine the score they give to the
|
||||
// nodes for the given channel size.
|
||||
@@ -81,7 +82,7 @@ func (c *WeightedCombAttachment) NodeScores(g ChannelGraph, chans []LocalChannel
|
||||
log.Tracef("Getting scores from sub heuristic %v", h.Name())
|
||||
|
||||
s, err := h.NodeScores(
|
||||
g, chans, chanSize, nodes,
|
||||
ctx, g, chans, chanSize, nodes,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get sub score: %w",
|
||||
|
Reference in New Issue
Block a user