diff --git a/common/route.c b/common/route.c index d20c6cc72eab..1c23b24e5c54 100644 --- a/common/route.c +++ b/common/route.c @@ -110,7 +110,10 @@ static bool dijkstra_to_hops(struct route_hop **hops, return false; gossmap_chan_get_capacity(gossmap, c, &total); - (*hops)[num_hops].total_amount.millisatoshis = total.satoshis * 1000; /* Raw: simpler. */ + + if (!amount_sat_to_msat(&(*hops)[num_hops].capacity, total)) + abort(); + (*hops)[num_hops].amount = *amount; (*hops)[num_hops].delay = *cltv; diff --git a/common/route.h b/common/route.h index 6d893622032d..17ffbe6dcb30 100644 --- a/common/route.h +++ b/common/route.h @@ -26,7 +26,7 @@ struct route_hop { int direction; struct node_id node_id; struct amount_msat amount; - struct amount_msat total_amount; + struct amount_msat capacity; u32 delay; }; diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 04d365fa8dca..97ed78ab739a 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -505,7 +505,7 @@ static void payment_exclude_most_expensive(struct payment *p) } } channel_hints_update(p, e->scid, e->direction, false, false, NULL, - e->total_amount, NULL); + e->capacity, NULL); } static void payment_exclude_longest_delay(struct payment *p) @@ -521,7 +521,7 @@ static void payment_exclude_longest_delay(struct payment *p) } } channel_hints_update(p, e->scid, e->direction, false, false, NULL, - e->total_amount, NULL); + e->capacity, NULL); } static struct amount_msat payment_route_fee(struct payment *p) @@ -1536,7 +1536,7 @@ handle_intermediate_failure(struct command *cmd, case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING: /* All of these result in the channel being marked as disabled. */ channel_hints_update(root, errchan->scid, errchan->direction, - false, false, NULL, errchan->total_amount, + false, false, NULL, errchan->capacity, NULL); break; @@ -1555,7 +1555,7 @@ handle_intermediate_failure(struct command *cmd, * remember the amount we tried as an estimate. */ channel_hints_update(root, errchan->scid, errchan->direction, true, false, &estimated, - errchan->total_amount, NULL); + errchan->capacity, NULL); goto error; } @@ -3173,7 +3173,7 @@ static void routehint_step_cb(struct routehints_data *d, struct payment *p) hop.amount = dest_amount; hop.delay = route_cltv(d->final_cltv, routehint + i + 1, tal_count(routehint) - i - 1); - hop.total_amount = estimate; + hop.capacity = estimate; /* Should we get a failure inside the routehint we'll * need the direction so we can exclude it. Luckily @@ -3542,7 +3542,7 @@ static void direct_pay_override(struct payment *p) { p->route[0].scid = hint->scid.scid; p->route[0].direction = hint->scid.dir; p->route[0].node_id = *p->route_destination; - p->route[0].total_amount = hint->overall_capacity; + p->route[0].capacity = hint->overall_capacity; paymod_log(p, LOG_DBG, "Found a direct channel (%s) with sufficient " "capacity, skipping route computation.",