Skip to content

Commit

Permalink
pay: If the channel_hint matches our allocation allow it
Browse files Browse the repository at this point in the history
It means we consume the channel completely to the best of our
knowledge, so let that through.

Changelog-Fixed: pay: Squeezed out the last `msat` from our local view of the network
  • Loading branch information
cdecker committed Jul 21, 2022
1 parent 0ae425e commit 2532e8b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions plugins/libplugin-pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ static bool payment_chanhints_apply_route(struct payment *p, bool remove)
/* For all channels we check that they have a
* sufficiently large estimated capacity to have some
* chance of succeeding. */
apply &= amount_msat_greater(curhint->estimated_capacity,
curhop->amount);
apply &= amount_msat_greater_eq(curhint->estimated_capacity,
curhop->amount);

if (!apply) {
/* This can happen in case of multiple
Expand All @@ -530,6 +530,15 @@ static bool payment_chanhints_apply_route(struct payment *p, bool remove)
type_to_string(tmpctx,
struct short_channel_id_dir,
&curhint->scid));
paymod_log(
p, LOG_DBG,
"Capacity: estimated_capacity=%s, hop_amount=%s. "
"HTLC Budget: htlc_budget=%d, local=%d",
type_to_string(tmpctx, struct amount_msat,
&curhint->estimated_capacity),
type_to_string(tmpctx, struct amount_msat,
&curhop->amount),
curhint->htlc_budget, curhint->local);
return false;
}
}
Expand Down

0 comments on commit 2532e8b

Please sign in to comment.