Browse Source

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>
fix-test_pay_direct-flake
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
05f95b59c1
  1. 1
      CHANGELOG.md
  2. 6
      gossipd/routing.c

1
CHANGELOG.md

@ -39,6 +39,7 @@ changes.
(eg. 4 billion) was slow due to a bug.
- Fixed occasional deadlock with peers when exchanging huge amounts of gossip.
- You can no longer make giant unpayable "wumbo" invoices.
- CLTV of total route now correctly evaluated when finding best route.
### Security

6
gossipd/routing.c

@ -529,9 +529,13 @@ find_route(const tal_t *ctx, struct routing_state *rstate,
best = 0;
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;
}
status_trace("=> chose %i hop solution", best);
/* No route? */
if (dst->bfg[best].total >= INFINITE) {

Loading…
Cancel
Save