config+pilot: define autopilot.heuristic

And validate the config set by the user.
This commit is contained in:
Johan T. Halseth committed 2019-01-23 09:05:42 +01:00
1 parent c0fed861d2
commit 36e7694e8e
3 files changed
+90 -7

No files matched your search

+21
View File
@@ -142,6 +142,27 @@ type AttachmentHeuristic interface {
map[NodeID]*NodeScore, error)
}
var (
// availableHeuristics holds all heuristics possible to combine for use
// with the autopilot agent.
availableHeuristics = []AttachmentHeuristic{
NewPrefAttachment(),
}
// AvailableHeuristics is a map that holds the name of available
// heuristics to the actual heuristic for easy lookup. It will be
// filled during init().
AvailableHeuristics = make(map[string]AttachmentHeuristic)
)
func init() {
// Fill the map from heuristic names to available heuristics for easy
// lookup.
for _, h := range availableHeuristics {
AvailableHeuristics[h.Name()] = h
}
}
// ChannelController is a simple interface that allows an auto-pilot agent to
// open a channel within the graph to a target peer, close targeted channels,
// or add/remove funds from existing channels via a splice in/out mechanisms.