autopilot/interface: remove NeedMoreChans from AttachmentHeuristic

Since the agent is now querying the constraints directly, NeedMoreChans
is no longer needed on the heuristic.
This commit is contained in:
Johan T. Halseth 2018-12-19 14:54:53 +01:00
parent fbfc9a53af
commit d0c4e253c6
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
3 changed files with 0 additions and 32 deletions

@ -74,11 +74,6 @@ type mockHeuristic struct {
quit chan struct{} quit chan struct{}
} }
func (m *mockHeuristic) NeedMoreChans(chans []Channel,
balance btcutil.Amount) (btcutil.Amount, uint32, bool) {
return 0, 0, false
}
type directiveArg struct { type directiveArg struct {
graph ChannelGraph graph ChannelGraph
amt btcutil.Amount amt btcutil.Amount

@ -111,16 +111,6 @@ 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 {
// NeedMoreChans is a predicate that should return true if, given the
// passed parameters, and its internal state, more channels should be
// opened within the channel graph. If the heuristic decides that we do
// indeed need more channels, then the second argument returned will
// represent the amount of additional funds to be used towards creating
// channels. This method should also return the exact *number* of
// additional channels that are needed in order to converge towards our
// ideal state.
NeedMoreChans(chans []Channel, balance btcutil.Amount) (btcutil.Amount, uint32, bool)
// NodeScores is a method that given the current channel graph, current // NodeScores is a method that given the current channel graph, current
// set of local channels and funds available, scores the given nodes // set of local channels and funds available, scores the given nodes
// according to the preference of opening a channel with them. The // according to the preference of opening a channel with them. The

@ -42,23 +42,6 @@ func NewConstrainedPrefAttachment(
// AttachmentHeuristic interface. // AttachmentHeuristic interface.
var _ AttachmentHeuristic = (*ConstrainedPrefAttachment)(nil) var _ AttachmentHeuristic = (*ConstrainedPrefAttachment)(nil)
// NeedMoreChans is a predicate that should return true if, given the passed
// parameters, and its internal state, more channels should be opened within
// the channel graph. If the heuristic decides that we do indeed need more
// channels, then the second argument returned will represent the amount of
// additional funds to be used towards creating channels.
//
// NOTE: This is a part of the AttachmentHeuristic interface.
func (p *ConstrainedPrefAttachment) NeedMoreChans(channels []Channel,
funds btcutil.Amount) (btcutil.Amount, uint32, bool) {
// We'll try to open more channels as long as the constraints allow it.
availableFunds, availableChans := p.constraints.ChannelBudget(
channels, funds,
)
return availableFunds, availableChans, availableChans > 0
}
// NodeID is a simple type that holds an EC public key serialized in compressed // NodeID is a simple type that holds an EC public key serialized in compressed
// format. // format.
type NodeID [33]byte type NodeID [33]byte