Commit Graph
181 Commits
Author SHA1 Message Date
Eng Zer Jun 1dcc7d74e6 autopilot: replace defer cleanup with t.Cleanup
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-10-13 17:01:31 +08:00
ErikEk 6146b8d644 trivial typo[skip ci] 2022-07-01 11:21:46 +02:00
Oliver Gugger 8451d6155f Merge pull request #6504 from tvolk131/fatalf_to_require
Move simple t.Fatalf test assertions to require.NoError
2022-06-17 19:52:07 +02:00
Tommy Volk 9a10c80bcb multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
Oliver Gugger ed40eddafd autopilot: return early for empty graph
This fixes an issue where the diameter calculation would crash if the
graph is empty.
2022-06-16 10:10:27 +02:00
Oliver Gugger 7dfe4018ce multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
bitromortac 45a2dc80c8 autopilot: implement cached ChannelGraph
Using the cached implementation of a ChannelGraph greatly speeds up the
conversion of the channel database to a SimpleGraph.
2022-03-07 11:15:47 +01:00
bitromortac 52d56a8990 lnrpc+autopilot: add graph diameter calculation
* adds a brute force computation of the diameter
* adds a more efficient calculation of the diameter
2022-03-07 11:15:47 +01:00
Oliver Gugger dfdc2bff8b multi: run gosimports 2022-02-10 11:02:01 +01:00
Dimitris Apostolou 530a2059e5 multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
Oliver Gugger d6fa912188 multi: further decouple graph
To further separate the channel graph from the channel state, we
refactor the AddrsForNode method to use the graphs's public methods
instead of directly accessing any buckets. This makes sure that we can
have the channel state cached with just its buckets while not using a
kvdb level cache for the graph.
At the same time we refactor the graph's test to also be less dependent
upon the channel state DB.
2021-09-29 17:00:03 +02:00
Andras Banki-Horvath 14c851c8fc kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
yyforyongyu e3a6cd8412 autopilot: fix typo 2020-12-04 23:07:52 +08:00
Conner Fromknecht 1b97bcdac1 Merge pull request #4783 from yyforyongyu/autopilot-code-fix
autopilot: fix returned map size in mergeNodeMaps
2020-11-19 11:10:48 -08:00
yyforyongyu 9336b9b3d4 autopilot: typo fix 2020-11-19 14:34:29 +08:00
yyforyongyu 0ace42649e autopilot: fix returned map size in mergeNodeMaps 2020-11-19 14:30:11 +08:00
Johan T. Halseth dbeafe8832 autopilot: rename to Capacity to Balance, define ChannelInfo()
We rename the field Capacity on local channels to Balance, define a new
method ChannelInfo on the manager config that let us query the database
for our latest channels state. Using this we will use the current local
balance instead of the channel capacity when doing allocation
calculations.
2020-10-05 12:24:07 +02:00
Johan T. Halseth d40cf6b592 autopilot: split channel definition into LocalChannel/ChannelEdge
Since non-local channels won't have a balance field, we split the
definitions in anticipation of adding one.
2020-10-05 12:24:07 +02:00
Johan T. Halseth 3e1755ee99 autopilot: remove unimpleneted SpliceIn/Out methods 2020-10-05 12:16:50 +02:00
Johan T. Halseth 392d6ccc9f autopilot: remove unused channel field FundedAmt 2020-10-05 12:16:50 +02:00
Andras Banki-Horvath afbbeae4f2 autopilot+test: testify betweenness centrality tests
The commit also reindents the source to conform with ts=8 guideline.
2020-07-17 16:12:55 +02:00
Andras Banki-Horvath ccabad8607 autopilot: add TopCentrality to the available heuristics 2020-07-17 16:12:54 +02:00
Andras Banki-Horvath 8373b2ad20 autopilot: add greedy "TopK" centrality heuristic
This commit creates a new autopilot heuristic which simply returns
normalized betweenness centrality values for the current graph. This
new heuristic will make it possible to prefer nodes with large
centrality when we're trying to open channels. The heuristic is also
somewhat dumb as it doesn't try to figure out the best nodes, as that'd
require adding ghost edges to the graph recalculating the centrality as
many times as many nodes there are (minus the one we already have
channels with).
2020-07-17 16:12:54 +02:00
Andras Banki-Horvath 82ddccee0b autopilot+test: make centrality test data available for other tests 2020-07-17 16:12:53 +02:00
Andras Banki-Horvath 906b0b707b atpl: remove unneeded extra filter on address availability
This commit removes an extra filter on address availability which is not
needed as the scored nodes are a already prefiltered subset of the whole
graph where address availability has already been checked.
2020-07-17 16:12:48 +02:00
Conner Fromknecht d0d2ca403d multi: rename ReadTx to RTx 2020-05-26 18:20:37 -07:00
Conner Fromknecht 90d3bf532d channeldb+routing: remove tx arg for ForEachNode 2020-05-12 17:53:20 -07:00
Andras Banki-Horvath 556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 0679d1dd4b autopilot: append instead of appends in a loop 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath 919710467e autopilot: tidying up source code to fit to 80 cols 2020-03-30 16:36:13 +02:00
Andras Banki-Horvath 608354032c autopilot: parallelize betweenness centrality
This commit parallelizes betweenness centrality calculation, by
distributing the algo to N workers and creating partial results.
2020-03-27 13:56:10 +01:00
Andras Banki-Horvath 3fe9c70722 autopilot: betweenness centrality using Brandes algo on simplifed graph
This commit adds betweenness centrality to the available node metrics.
Betweenness centrality is a per node centrality measure which for an
arbitrary node v equals to the sum of shortest paths going trough v
divided by the number of all shortest paths for for each vertex pair
k, s where k != s != v.
2020-03-27 10:39:50 +01:00
Andras Banki-Horvath be83d504f8 autopilot: introduce NodeMetric interface for arbitrary graph metrics
This commit adds the NodeMetric interface which will be used for all
graph metrics not directly part of the autopilot but are useful in
composite heuristics to drive autopilot decisions and improve node
scores.
2020-03-27 10:36:28 +01:00
Olaoluwa Osuntokun 21521ff610 autopilot: convert to use new kvdb abstraction 2020-03-18 19:35:20 -07:00
Joost Jager 6e0cfe579b Merge pull request #3841 from joostjager/check-max-onion-size
routing: check max routing info size
2019-12-20 14:42:47 +01:00
Joost Jager 95ddab57fa channeldb: add tx argument for FetchLightningNode
To allow execution within an existing tx.
2019-12-20 10:17:01 +01:00
Andras Banki-Horvath 2c3041d8bc autopilot: fix memChannelGraph channel edge addition
This PR fixes an issue that happens when adding a new channel edge
between two nodes in a memChannelGraph. Originally a channel edge held a
node value which made the graph different when iterating from the two
endpoints of an edge. This is simply fixed by holding pointers instead.
2019-12-19 22:42:37 +01:00
Joost Jager 37d9ee302c channeldb: take serialized key to fetch lightning node
This prevents inefficient key conversions in a follow up commit that
change the inner pathfinding loop.
2019-12-19 12:44:00 +01:00
Conner Fromknecht 5e27b5022c multi: remove LocalFeatures and GlobalFeatures 2019-11-08 05:32:00 -08:00
Olaoluwa Osuntokun 083b574fd8 autopilot: fix race condition in new test 2019-11-01 19:30:21 -07:00
Johan T. Halseth 5a8ecfcc49 autopilot/agent_test: add TestAgentHeuristicUpdateSignal
TestAgentHeuristicUpdateSignal tests that upon notification about a
heuristic update, the agent reconsults the heuristic.
2019-10-31 10:19:50 +01:00
Johan T. Halseth 7524265ab1 autopilot: trigger agent channel open on new scores
This commit adds a new signal to the autopilot agent, meant to signal
when any of the available heuristics has gotten an update.

We currently use this to trigger a new channel opening after the
external scores have been updated.
2019-10-31 10:17:31 +01:00
Johan T. Halseth f0ba4be758 autopilot/manager: fix slice modifications
When appending to a slice, there is no guarantee the slice won't be
modified. So instead of appending to the global slice
availableHeuristics, we create a temporary local one.
2019-10-31 10:17:31 +01:00
Johan T. Halseth df5baa4275 autopilot/agent: trace log reason nodes being skipped 2019-10-31 10:17:31 +01:00
Joost Jager 3d7de2ad39 multi: remove dead code 2019-09-10 17:21:59 +02:00
Johan T. Halseth 2f1aad257c autopilot/agent: trace log skipped nodes during scoring 2019-09-02 10:41:00 +02:00
Johan T. Halseth d5ab95546e autopilot/combinedattach: trace log scoring process from sub heuristics 2019-09-02 10:40:59 +02:00
Johan T. Halseth b2560b4ad2 autopilot/externalscoreattach: trace log scoring process 2019-09-02 10:40:59 +02:00
Johan T. Halseth bad9f4b685 autopilot/prefattach: trace log score process 2019-09-02 10:40:58 +02:00
Johan T. Halseth 2dbc4fe973 autopilot/agent: move expensive graph lookup after channel size check 2019-09-02 10:35:14 +02:00