1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-20 02:27:32 +01:00
eclair/eclair-core
Bastien Teinturier ba4cca29e5
Use channel balance in path-finding (#1395)
* Use channel capacity and balance in path-finding

The path finding algorithm uses channel capacity instead of htlcMaximumMsat.
It also takes into account channel balance when available and excludes
channels that don't have enough funds to relay the payment.

This change also fixes an off-by-one error in weight computation: we were
incorrectly applying a channel's fee to the amount that needs to be relayed
through that channel (whereas this is instead what the node needs to receive
to collect enough fee *before* relaying).

* Refactor Graph file

Add documentation, update comments, rename fields and reformat to (helpfully)
make the code clearer.

* Simplify path-fiding implementation

There were a couple confusing steps in the implementation of Yen's algorithm.

The first one was the computation of the `edgesToIgnore` and the specific
handling of the case i = 0. This specific case wasn't needed and made the
code a bit hard to read.

The second one was the weight provided to dijkstra for spur paths.
The weight of the root path was applied to the target node. It was probably
an attempt to take into account the fact that dijkstra wasn't computing
a complete path and that fees may not match, but it couldn't really work.
I removed that and added a fee check at the end of the path-finding.

* Update graph balance for duplicate channel_update

This case regularly happens after a restart: the router already has the
latest channel_update for that channel, but we want to update the graph's
balances because they are all at `None` after a restart.
2020-05-11 09:49:27 +02:00
..
src Use channel balance in path-finding (#1395) 2020-05-11 09:49:27 +02:00
eclair-cli Typed amounts (#1088) 2019-08-07 17:37:38 +02:00
pom.xml Release 0.4 (#1409) 2020-05-05 14:55:09 +02:00