306c4aef8e
This commit introduces the initial implementation of the autopilot mode. Autopilot is new mode within lnd that enables automatic channel management. This means that if enabled lnd will attempt to automatically manage channels according to a set of heuristic defined within the main configuration for autopilot.Agent instance. The autopilot.Agent implements a simple closed control loop. It takes in external signals such as wallet balance updates, new open channel, and channels that are now closed the updates its internal state. With each external trigger it will consult the registered AttachmentHeuristic to decide: if it needs to open any more channels, and if so how much it should use to open the channels, ultimately returning a set of recommended AttachmentDirectives. The autopilot.Agent loop will then take those attempt to establish connection, and go back in waiting for a new external signal. With this first implementation the default heuristic is the ConstrainedPrefAttachment implementation of AttachmentHeuristic. Given a min and max channel size, a limit on the number of channels, and the percentage of wallet funds to allocate to channels, it will attempt to execute a heuristic drive by the Barabási–Albert model model in order to attempt to drive the global graph towards a scale free topology. This is commit implements a foundational layer for future simulations, optimization, and additional heuristics.
27 lines
693 B
Go
27 lines
693 B
Go
package autopilot
|
|
|
|
import "github.com/btcsuite/btclog"
|
|
|
|
// log is a logger that is initialized with no output filters. This
|
|
// means the package will not perform any logging by default until the caller
|
|
// requests it.
|
|
var log btclog.Logger
|
|
|
|
// The default amount of logging is none.
|
|
func init() {
|
|
DisableLog()
|
|
}
|
|
|
|
// DisableLog disables all library log output. Logging output is disabled
|
|
// by default until UseLogger is called.
|
|
func DisableLog() {
|
|
log = btclog.Disabled
|
|
}
|
|
|
|
// UseLogger uses a specified Logger to output package logging info.
|
|
// This should be used in preference to SetLogWriter if the caller is also
|
|
// using btclog.
|
|
func UseLogger(logger btclog.Logger) {
|
|
log = logger
|
|
}
|