mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
gossipd: take into account risk in final route comparison.
We were only comparing by total msatoshis. Note, this *still* isn't sufficient to fix our indirect problem, as our risk values are all 1 (the minimum): lightning_gossipd(25480): 2 hop solution: 1501990 + 2 lightning_gossipd(25480): 3 hop solution: 1501971 + 3 ... lightning_gossipd(25480): => chose 3 hop solution Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
662bb0c565
commit
05f95b59c1
@@ -39,6 +39,7 @@ changes.
|
|||||||
(eg. 4 billion) was slow due to a bug.
|
(eg. 4 billion) was slow due to a bug.
|
||||||
- Fixed occasional deadlock with peers when exchanging huge amounts of gossip.
|
- Fixed occasional deadlock with peers when exchanging huge amounts of gossip.
|
||||||
- You can no longer make giant unpayable "wumbo" invoices.
|
- You can no longer make giant unpayable "wumbo" invoices.
|
||||||
|
- CLTV of total route now correctly evaluated when finding best route.
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
|||||||
@@ -529,9 +529,13 @@ find_route(const tal_t *ctx, struct routing_state *rstate,
|
|||||||
|
|
||||||
best = 0;
|
best = 0;
|
||||||
for (i = 1; i <= max_hops; i++) {
|
for (i = 1; i <= max_hops; i++) {
|
||||||
if (dst->bfg[i].total < dst->bfg[best].total)
|
status_trace("%i hop solution: %"PRIu64" + %"PRIu64,
|
||||||
|
i, dst->bfg[i].total, dst->bfg[i].risk);
|
||||||
|
if (dst->bfg[i].total + dst->bfg[i].risk
|
||||||
|
< dst->bfg[best].total + dst->bfg[best].risk)
|
||||||
best = i;
|
best = i;
|
||||||
}
|
}
|
||||||
|
status_trace("=> chose %i hop solution", best);
|
||||||
|
|
||||||
/* No route? */
|
/* No route? */
|
||||||
if (dst->bfg[best].total >= INFINITE) {
|
if (dst->bfg[best].total >= INFINITE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user