diff --git a/common/route.c b/common/route.c index 06bf205a2..54b6e6e99 100644 --- a/common/route.c +++ b/common/route.c @@ -94,10 +94,6 @@ static bool dijkstra_to_hops(struct route_hop **hops, /* OK, populate other fields. */ c = dijkstra_best_chan(dij, curidx); - gossmap_chan_get_capacity(gossmap, c, &total); - if (!amount_sat_to_msat(&(*hops)[num_hops].total_amount, total)) - abort(); - if (c->half[0].nodeidx == curidx) { (*hops)[num_hops].direction = 0; } else { @@ -113,6 +109,8 @@ static bool dijkstra_to_hops(struct route_hop **hops, if (!dijkstra_to_hops(hops, gossmap, dij, next, amount, cltv)) return false; + gossmap_chan_get_capacity(gossmap, c, &total); + (*hops)[num_hops].total_amount.millisatoshis = total.satoshis * 1000; /* Raw: simpler. */ (*hops)[num_hops].amount = *amount; (*hops)[num_hops].delay = *cltv; diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index bebd7e709..c93024d84 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -1618,6 +1618,7 @@ handle_intermediate_failure(struct command *cmd, break; case WIRE_TEMPORARY_CHANNEL_FAILURE: { + memcheck(&errchan->amount, sizeof(struct amount_msat)); estimated = errchan->amount; /* Subtract one msat more, since we know that the amount did not diff --git a/plugins/pay.c b/plugins/pay.c index b0b29e9e5..4c5f253bd 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -22,6 +22,7 @@ static struct node_id my_id; static unsigned int maxdelay_default; static bool exp_offers; static bool disablempp = false; +static struct channel_hint *global_hints; static LIST_HEAD(payments); @@ -582,6 +583,10 @@ static const char *init(struct plugin *p, */ /* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */ maxdelay_default = 2016; + + global_hints = + notleak_with_children(tal_arr(p, struct channel_hint, 0)); + /* max-locktime-blocks deprecated in v24.05, but still grab it! */ rpc_scan(p, "listconfigs", take(json_out_obj(NULL, NULL, NULL)),