diff --git a/CHANGELOG.md b/CHANGELOG.md index ecbe90f78..47e7a8efb 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/gossipd/routing.c b/gossipd/routing.c index 1a23dd8c8..5fcf2a2b8 100644 --- a/gossipd/routing.c +++ b/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) {