Skip to content

Commit

Permalink
renepay: add precondition check + error msg
Browse files Browse the repository at this point in the history
Signed-off-by: Lagrang3 <[email protected]>
  • Loading branch information
Lagrang3 committed Aug 15, 2024
1 parent 5d13c82 commit 7aa263b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/renepay/mods.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ static struct command_result *compute_routes_cb(struct payment *payment)

/* How much are we still trying to send? */
if (!amount_msat_sub(&remaining, payment->payment_info.amount,
payment->total_delivering)) {
payment->total_delivering) ||
amount_msat_zero(remaining)) {
plugin_log(pay_plugin->plugin, LOG_UNUSUAL,
"%s: Payment is pending with full amount already "
"committed. We skip the computation of new routes.",
Expand Down
5 changes: 5 additions & 0 deletions plugins/renepay/routebuilder.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ struct route **get_routes(const tal_t *ctx,
"Failed to build disabled_bitmap.");
goto function_fail;
}
if (amount_msat_zero(amount_to_deliver)) {
tal_report_error(ctx, ecode, fail, RENEPAY_PRECONDITION_ERROR,
"amount to deliver is zero");
goto function_fail;
}

/* Also disable every channel that we don't have in the chan_extra_map.
* We might have channels in the gossmap that are not usable for
Expand Down

0 comments on commit 7aa263b

Please sign in to comment.