autopilot/agent: call ChannelBudget on constrainsts
We let the agent call ChannelBudget on its constraints directly, and not go through the heuristic. This is needed since when we want to have multiple active heuristics concurrently, it won't make sense anymore to ask each of the heuristics. The mockConstraints are also updated to act as the mockHeuristic did before, by making it possible to control the responses it gives by sending them on the contained channels.
This commit is contained in:
2 files changed
+108
-96
No files matched your search
+5
-4
@@ -478,12 +478,13 @@ func (a *Agent) controller() {
|
||||
a.pendingMtx.Unlock()
|
||||
|
||||
// Now that we've updated our internal state, we'll consult our
|
||||
// channel attachment heuristic to determine if we should open
|
||||
// up any additional channels or modify existing channels.
|
||||
availableFunds, numChans, needMore := a.cfg.Heuristic.NeedMoreChans(
|
||||
// channel attachment heuristic to determine if we can open
|
||||
// up any additional channels while staying within our
|
||||
// constraints.
|
||||
availableFunds, numChans := a.cfg.Constraints.ChannelBudget(
|
||||
totalChans, a.totalBalance,
|
||||
)
|
||||
if !needMore {
|
||||
if numChans == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user