diff --git a/autopilot/agent_test.go b/autopilot/agent_test.go index df368ca5..d1de9ccc 100644 --- a/autopilot/agent_test.go +++ b/autopilot/agent_test.go @@ -80,6 +80,10 @@ type directiveArg struct { nodes map[NodeID]struct{} } +func (m *mockHeuristic) Name() string { + return "mock" +} + func (m *mockHeuristic) NodeScores(g ChannelGraph, chans []Channel, fundsAvailable btcutil.Amount, nodes map[NodeID]struct{}) ( map[NodeID]*NodeScore, error) { diff --git a/autopilot/combinedattach.go b/autopilot/combinedattach.go index deaa4af8..fa6a4830 100644 --- a/autopilot/combinedattach.go +++ b/autopilot/combinedattach.go @@ -47,6 +47,13 @@ func NewWeightedCombAttachment(h ...*WeightedHeuristic) ( // AttachmentHeuristic interface. var _ AttachmentHeuristic = (*WeightedCombAttachment)(nil) +// Name returns the name of this heuristic. +// +// NOTE: This is a part of the AttachmentHeuristic interface. +func (c *WeightedCombAttachment) Name() string { + return "weightedcomb" +} + // NodeScores is a method that given the current channel graph, current set of // local channels and funds available, scores the given nodes according to the // preference of opening a channel with them. The returned channel candidates diff --git a/autopilot/interface.go b/autopilot/interface.go index ec80d6a2..d905aacf 100644 --- a/autopilot/interface.go +++ b/autopilot/interface.go @@ -119,6 +119,9 @@ type AttachmentDirective struct { // the interface is to allow an auto-pilot agent to decide if it needs more // channels, and if so, which exact channels should be opened. type AttachmentHeuristic interface { + // Name returns the name of this heuristic. + Name() string + // NodeScores is a method that given the current channel graph and // current set of local channels, scores the given nodes according to // the preference of opening a channel of the given size with them. The diff --git a/autopilot/prefattach.go b/autopilot/prefattach.go index bb010239..de27fc56 100644 --- a/autopilot/prefattach.go +++ b/autopilot/prefattach.go @@ -43,6 +43,13 @@ func NewNodeID(pub *btcec.PublicKey) NodeID { return n } +// Name returns the name of this heuristic. +// +// NOTE: This is a part of the AttachmentHeuristic interface. +func (p *PrefAttachment) Name() string { + return "preferential" +} + // NodeScores is a method that given the current channel graph and current set // of local channels, scores the given nodes according to the preference of // opening a channel of the given size with them. The returned channel