Commit Graph

165 Commits

Author SHA1 Message Date
Simon Horlick
a43d7d3532 autopilot: Make autopilot aware of channel open failures 2018-01-27 18:35:31 -08:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Olaoluwa Osuntokun
2e2b262999
autopilot: ensure access to pendingOpens in thread-safe when logging 2017-12-10 15:46:49 -08:00
Olaoluwa Osuntokun
9bcb139bcc
autopilot: shuffle set of candidates using Fisher–Yates before selecting
In this commit we modify the ConstrainedPrefAttachment.Select method to
first shuffle the set of potential candidates before selecting them.
This serves to remove the existing grouping between candidates which
may have influenced the selection.
2017-10-30 18:55:55 -07:00
Jim Posen
9fd77a6e40 multi: Update lnd to use new feature vector API. 2017-10-17 22:47:20 -07:00
Olaoluwa Osuntokun
0769cae565
autopilot: remove spammy trace log 2017-09-03 16:46:56 -07:00
Olaoluwa Osuntokun
8d88f98297
autopilot: update graph.go to match recent API changes 2017-08-22 00:52:31 -07:00
Olaoluwa Osuntokun
77e3e74ea2
autopilot: for ConstrainedPrefAttachment.Select factor in skipNodes
This commit modifies the Select method for the
ConstrainedPrefAttachment attachment heuristic slightly. Previously, it
was possible for an autopilot.Agent to go over the allotted number of
channels as it would unconditionally attempt to establish channel with
all returned Attachment Directives. To remedy this, we now assume that
we already have active, or pending channels to each of the nodes in the
set of skipNodes. Therefore, we now use the size of the skipNodes map
as an  upper limit within the primary selection loop.
2017-08-22 00:51:43 -07:00
Olaoluwa Osuntokun
a8576eaa69
autopilot: fix bug in skip nodes test, use new instance for each run 2017-08-22 00:51:39 -07:00
Olaoluwa Osuntokun
804edb8f02
autopilot: ensure all access to pendingOpens is thread-safe
In this commit, we ensure that we grab the mutex for the pending open
channel state when we attempt to merge the pending state with the
committed state.
2017-08-22 00:51:33 -07:00
Olaoluwa Osuntokun
09521b9c2a
autopilot: fix linter error 2017-08-15 18:26:59 -07:00
Olaoluwa Osuntokun
711b695a2f
autopilot: add tracking of pending channel state
This commit adds tracking of the pending channels state within the
autopilot.Agent. This fixes a class of bugs which was discovered during
the latest test net block storm wherein the Agent would attempt to
repeatedly attach to the same node due to rapid closure of other
channels.

In this commit we fix this issue by ensuring that we always factor in
the pending channel state when querying the heuristic w.r.t if we need
more channels, and if so to which nodes should be attached to.
2017-08-15 18:23:58 -07:00
Olaoluwa Osuntokun
8034780ca4
autopilot: fix chanID collision test flake by instead using atomic counter
This commit fixes a prior occasional test flake caused by the collision
of the randomly selected 64-bit integers. In order to get around this,
we now instead have a atomic monotonically increasing counter for each
channel ID used within the tests.
2017-08-15 17:56:24 -07:00
Olaoluwa Osuntokun
48be9261ef
autopilot: fix linter error 2017-08-10 22:07:22 -07:00
Olaoluwa Osuntokun
306c4aef8e
autopilot: "Look ma no hands!", introducing autopilot mode
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.
2017-08-10 21:14:55 -07:00