autopilot/interface+choice: add NodeScore type
We create a new type NodeScore which is a tuple (NodeID, score). The weightedChoice and chooseN algorithms are altered to expect this type. This is done in order to simplify the types we are using, since we were only using a subset of the fields in AttachmentDirective.
This commit is contained in:
4 files changed
+54
-21
No files matched your search
@@ -81,6 +81,18 @@ type ChannelGraph interface {
|
||||
ForEachNode(func(Node) error) error
|
||||
}
|
||||
|
||||
// NodeScore is a tuple mapping a NodeID to a score indicating the preference
|
||||
// of opening a channel with it.
|
||||
type NodeScore struct {
|
||||
// NodeID is the serialized compressed pubkey of the node that is being
|
||||
// scored.
|
||||
NodeID NodeID
|
||||
|
||||
// Score is the score given by the heuristic for opening a channel of
|
||||
// the given size to this node.
|
||||
Score float64
|
||||
}
|
||||
|
||||
// AttachmentDirective describes a channel attachment proscribed by an
|
||||
// AttachmentHeuristic. It details to which node a channel should be created
|
||||
// to, and also the parameters which should be used in the channel creation.
|
||||
|
||||
Reference in new issue
Block a user