mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-25 16:23:49 +02:00
autopilot/interface: add Name() to AttachmentHeuristic interface
This commit is contained in:
parent
cebc4d8dba
commit
c0fed861d2
@ -80,6 +80,10 @@ type directiveArg struct {
|
|||||||
nodes map[NodeID]struct{}
|
nodes map[NodeID]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mockHeuristic) Name() string {
|
||||||
|
return "mock"
|
||||||
|
}
|
||||||
|
|
||||||
func (m *mockHeuristic) NodeScores(g ChannelGraph, chans []Channel,
|
func (m *mockHeuristic) NodeScores(g ChannelGraph, chans []Channel,
|
||||||
fundsAvailable btcutil.Amount, nodes map[NodeID]struct{}) (
|
fundsAvailable btcutil.Amount, nodes map[NodeID]struct{}) (
|
||||||
map[NodeID]*NodeScore, error) {
|
map[NodeID]*NodeScore, error) {
|
||||||
|
@ -47,6 +47,13 @@ func NewWeightedCombAttachment(h ...*WeightedHeuristic) (
|
|||||||
// AttachmentHeuristic interface.
|
// AttachmentHeuristic interface.
|
||||||
var _ AttachmentHeuristic = (*WeightedCombAttachment)(nil)
|
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
|
// 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
|
// local channels and funds available, scores the given nodes according to the
|
||||||
// preference of opening a channel with them. The returned channel candidates
|
// preference of opening a channel with them. The returned channel candidates
|
||||||
|
@ -119,6 +119,9 @@ type AttachmentDirective struct {
|
|||||||
// the interface is to allow an auto-pilot agent to decide if it needs more
|
// 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.
|
// channels, and if so, which exact channels should be opened.
|
||||||
type AttachmentHeuristic interface {
|
type AttachmentHeuristic interface {
|
||||||
|
// Name returns the name of this heuristic.
|
||||||
|
Name() string
|
||||||
|
|
||||||
// NodeScores is a method that given the current channel graph and
|
// NodeScores is a method that given the current channel graph and
|
||||||
// current set of local channels, scores the given nodes according to
|
// current set of local channels, scores the given nodes according to
|
||||||
// the preference of opening a channel of the given size with them. The
|
// the preference of opening a channel of the given size with them. The
|
||||||
|
@ -43,6 +43,13 @@ func NewNodeID(pub *btcec.PublicKey) NodeID {
|
|||||||
return n
|
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
|
// 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
|
// of local channels, scores the given nodes according to the preference of
|
||||||
// opening a channel of the given size with them. The returned channel
|
// opening a channel of the given size with them. The returned channel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user