common/dijkstra: remove dijkstra_amount().

Unless you're using amount as the sole cost function (we don't!), the
"cost" is not the "amount".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-05-22 16:40:01 +09:30
parent 2bb365a931
commit 3832542d27
4 changed files with 8 additions and 16 deletions

View File

@@ -48,12 +48,12 @@ static struct route_hop *least_cost(struct gossmap *map,
}
if (!amount_msat_add(&maxcost, sent, budget))
abort();
if (amount_msat_greater(dijkstra_amount(dij, srcidx), maxcost)) {
path = route_from_dijkstra(map, map, dij, src, sent, 0);
if (amount_msat_greater(path[0].amount, maxcost)) {
printf("failed (too expensive)\n");
return NULL;
return tal_free(path);
}
path = route_from_dijkstra(map, map, dij, src, sent, 0);
printf("# path length %zu\n", tal_count(path));
/* We don't pay fee on first hop! */
if (!amount_msat_sub(&fee, path[0].amount, sent))