Commit Graph

625 Commits

Author SHA1 Message Date
Wilmer Paulino
9216ef2cd7
Merge pull request #3855 from cfromknecht/sorted-policies
routing/pathfind_test: construct sorted edge policies
2019-12-20 10:27:28 -08: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
e3b9ed5cd8
Merge pull request #3863 from joostjager/fix-result-interpretation
routing: fix gap in result interpretation
2019-12-20 14:42:19 +01:00
carla
25a8773736
routing: interpret mpp timeout failues
This commit adds success mission control
results for all hops along the route in
a mpp timeout and takes no action for
the final hop along the route. This is a
temporary measure to prevent the default
logic from penalizing the final node while
we decide how to penalize mpp timeouts.
2019-12-20 13:02:30 +02:00
carla
e0c86f1e71
htlcswitch+invoices: fail mpp timeouts with FailMPPTimeout
This commit adds a getResolutionFailure function
which returns an appropriate wire failure based
on the outcome of a htlc resolution. It also updates
 the MissionControlStore test to ensure that lnd
can handle failures which occur due to mpp timeout.
2019-12-20 13:02:02 +02:00
Joost Jager
c84e57a522
routing: remove unnecessary newline 2019-12-20 11:00:07 +01:00
Joost Jager
b760b25229
routing: limit routing info size during pathfinding
Also the max hop count check can be removed, because the real bound is
the payload size. By moving the check inside the search loop, we now
also backtrack when we hit the limit.
2019-12-20 11:00:05 +01:00
Joost Jager
513341516e
routing: fix max route length test
Enable the test again and use a programmatically built network.
2019-12-20 11:00:03 +01:00
Joost Jager
e8fd05e8e3
tlv+record+routing: add payload size calculation 2019-12-20 11:00:01 +01:00
Joost Jager
72a6383975
routing: use absolute final expiry in pathfinding 2019-12-20 11:00:00 +01:00
Joost Jager
e546a2c42b
routing: more efficient feature validation
Also prepares for payload size tracking during pathfinding
2019-12-20 10:17:03 +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
Joost Jager
a3a1b488a6
routing: fix gap in result interpretation
Fixes an off by one error that skipped assigning a success pair. Added a
test that previously failed because of this bug.
2019-12-20 09:14:15 +01:00
Conner Fromknecht
ff443a389b
routing/pathfind_test: constructed sorted edge policies
This commit fixes a potential bug in our test harness, by ensuring that
the constructed node policies are configured _after_ sorting. Currently
the node pubkeys are sorted, but additional parameters (max htlc,
disabled, etc) are applied using the unsorted policies.

Most of the constructors used today use the symmetric channel
constructor, so this shouldn't cause an issue with the majority of our
tests. We recently introduced an asymmetric channel constructor for
which this could have been an issue, however, no known issues were
discovered.

Lastly, we remove the direction from the configuration altogether, and
derive it purely from the final sorting of the pubkeys.
2019-12-19 03:47:24 -08: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
f868bc128b
rpcserver+routerrpc: thread features + payment addr to SendPayment 2019-12-18 23:56:59 -08:00
Conner Fromknecht
0993256b77
routing/pathfind: set single-shot MPP if payment addr is known 2019-12-18 23:56:42 -08:00
Conner Fromknecht
7965cb08db
routing/pathfind: consolidate population of custom records 2019-12-18 23:56:23 -08:00
Conner Fromknecht
cddb71ee53
routing/pathfind: evaluate TLV support sooner
We move up the check for TLV support, since we will later use it to
determine if we can use dependent features, e.g. TLV records and payment
addresses.
2019-12-18 23:56:05 -08:00
Conner Fromknecht
e3a9603846
routing/pathfind: simplify cltv calculation 2019-12-18 23:55:47 -08:00
Conner Fromknecht
b97adf79a4
routing/pathfind: consolidate final vs non-final hop processing 2019-12-18 23:55:27 -08:00
Conner Fromknecht
495ae8ca42
routing: consolidate final hop params for newRoute
This commit creates a wrapper struct, grouping all parameters that
influence the final hop during route construction. This is a preliminary
step for passing in the receiver's invoice feature bits, which will be
used to select an appropriate payment or payload type.
2019-12-18 23:55:08 -08:00
Conner Fromknecht
71e05e05bf
routing/pathfind: set final hop features used in pathfinding
In this commit, we overwrite the final hop's features with either the
destination features or those loaded from the graph fallback. This
ensures that the same features used in pathfinding will be provided to
route construction.

In an earlier commit, we validated the final hop's transitive feature
dependencies, so we also add validation to non-final nodes.
2019-12-18 23:54:49 -08:00
Conner Fromknecht
990d55d08c
routing/pathfind: ensure final hop supports payment addrs
This commit adds an optional PaymentAddr field to the RestrictParams, so
that we can verify the final hop can support it before doing an
expensive round of pathfindig.
2019-12-18 23:54:31 -08:00
Conner Fromknecht
acb7b83ead
routing/pathfind: validate final hop feature dependencies 2019-12-18 23:54:11 -08:00
Conner Fromknecht
cfa3fe2921
routing/pathfind: fix TLV fallback for unadvertised hops
In this commit, we fix a bug that prevents us from sending custom
records to nodes that aren't in the graph. Previously we would simply
fail if we were unable to retrieve the node's features.

To remedy, we add the option of supplying the destination's feature bits
into path finding. If present, we will use them directly without
consulting the graph, resolving the original issue. Instead, we will
only consult the graph as a fallback, which will still fail if the node
doesn't exist since the TLV features won't be populated in the empty
feature vector.

Furthermore, this also permits us to provide "virtual features" into the
pathfinding logic, where we make assumptions about what the receiver
supports even if the feature vector isn't actually taken from an
invoice. This can useful in cases like keysend, where we don't have an
invoice, but we can still attempt the payment if we assume the receiver
supports TLV.
2019-12-18 23:53:51 -08:00
Conner Fromknecht
bd66c0d34e
routing/pathfind_test: allow custom node features
This commit allows custom node features to be populated in specific test
instances. For consistency, we auto-populate an empty feature vector for
nodes that have nil feature vectors before writing them to the database.
2019-12-18 23:53:32 -08:00
Conner Fromknecht
618810394c
routing/pathfind_test: add asymmetric chan consructor
Later this will be used to populate distinct feature vectors for either
end of the channel.
2019-12-18 23:53:18 -08:00
Joost Jager
d85f378aa2
routing: move zero hops check 2019-12-16 14:53:47 +01:00
Joost Jager
31b2c22cf5
routing: check for invalid routes 2019-12-16 14:53:45 +01:00
Joost Jager
b8abae6a7e
routing: rename route variable to prevent clash with package 2019-12-14 08:47:53 +01:00
Joost Jager
75aa4e7061
routing: require tlv capability for custom record payments
Previously if a payment was sent with custom records attached, path
finding wouldn't perform a check whether the final node was capable of
receiving custom records in a tlv payload.
2019-12-12 00:15:02 +01:00
Joost Jager
c37289cd94
routing: pass custom records into pathfinding 2019-12-12 00:15:00 +01:00
Joost Jager
d02de70d20
multi: do not use tlv.Record outside wire format handling
This commit prepares for more manipulation of custom records. A list of
tlv.Record types is more difficult to use than the more basic
map[uint64][]byte.

Furthermore fields and variables are renamed to make them more
consistent.
2019-12-12 00:14:58 +01:00
Joost Jager
b6eb3a69ba
routing+lnrpc+lncli: allow setting min htlc policy 2019-12-11 00:17:08 +01:00
Joost Jager
74c2df658e
localchans: log policy update error 2019-12-11 00:17:06 +01:00
Joost Jager
f289dbd826
routing: define subsystem constant 2019-12-11 00:17:04 +01:00
Joost Jager
ddb98fcc41
multi: distinguish between htlc in and out constraints 2019-12-11 00:16:57 +01:00
Joost Jager
883f9e5f9a
Merge pull request #3749 from joostjager/extended-routing-failures
routing: local balance check before path finding
2019-12-04 12:17:17 +01:00
Joost Jager
9ae014edf6
routing: use self instead of source node for creating unified policy
A unified policy differs between local channels and other channels on
the network. There is more information available for local channels and
this is used in the unified policy.

Previously we used the pathfinding source pubkey to determine whether to
apply the local channel logic or not. If queryroutes is executed with a
source node that isn't the self node, this wouldn't work.
2019-12-04 09:45:09 +01:00
Joost Jager
97344af8f3
routing: local balance check 2019-12-04 09:45:07 +01:00
Joost Jager
3aaf32dc2e
routing: improve equal cost route comparison
When the (virtual) payment attempt cost is set to zero, probabilities
are no longer a factor in determining the best route. In case of routes
with equal costs, we'd just go with the first one found. This commit
refines this behavior by picking the route with the highest probability.
So even though probability doesn't affect the route cost, it is still
used as a tie breaker.
2019-12-02 14:23:57 +01:00
Joost Jager
c15b0316a2
routing: use FailureReasonError for internal path finding errors 2019-11-27 15:21:12 +01:00
Joost Jager
b5f1bde604
routing: add error var for pre-built route tried 2019-11-27 15:21:10 +01:00
Joost Jager
ac2df9bbf4
routing: use simple errors for path finding 2019-11-27 15:21:08 +01:00
Joost Jager
6774b5a007
routing: remove unused error codes 2019-11-27 15:21:06 +01:00
Joost Jager
7e4f9dd70a
routing/test: simplify context instantiation 2019-11-26 21:40:30 +01:00
Joost Jager
f8e9efbf99
routing: allow route to self 2019-11-26 10:15:44 +01:00
Joost Jager
81b7798c03
routing: pop heap at the end of the loop
This prepares for routing to self.
2019-11-26 10:15:42 +01:00
Joost Jager
683282fa24
routing: check loop conditions at end
This prepares for routing to self. When checking the condition at the
start, the loop would terminate immediately because the source is equal
to the target.
2019-11-26 10:15:40 +01:00