Skip to content

Commit 65665a4

Browse files
cdeckerrustyrussell
authored andcommitted
pay: Remove use of temporary local channel_hint
We were using `channel_hint` to temporarily tweak the graph inside of a payment. However, these ad-hoc `channel_hints` are stickier than their predecessors, in that they outlive the payment attempt itself, and interfere with later ones. Changelog-Changed: pay: Discarding an overly long or expensive route does not blocklist channels anymore.
1 parent 8bf018f commit 65665a4

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

plugins/libplugin-pay.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -450,40 +450,6 @@ static void channel_hints_update(struct payment *p,
450450
}
451451
}
452452

453-
static void payment_exclude_most_expensive(struct payment *p)
454-
{
455-
struct route_hop *e = &p->route[0];
456-
struct amount_msat fee, worst = AMOUNT_MSAT(0);
457-
458-
for (size_t i = 0; i < tal_count(p->route)-1; i++) {
459-
if (!amount_msat_sub(&fee, p->route[i].amount, p->route[i+1].amount))
460-
paymod_err(p, "Negative fee in a route.");
461-
462-
if (amount_msat_greater_eq(fee, worst)) {
463-
e = &p->route[i];
464-
worst = fee;
465-
}
466-
}
467-
channel_hints_update(p, e->scid, e->direction, false, false, NULL,
468-
e->capacity, NULL);
469-
}
470-
471-
static void payment_exclude_longest_delay(struct payment *p)
472-
{
473-
struct route_hop *e = &p->route[0];
474-
u32 delay, worst = 0;
475-
476-
for (size_t i = 0; i < tal_count(p->route)-1; i++) {
477-
delay = p->route[i].delay - p->route[i+1].delay;
478-
if (delay >= worst) {
479-
e = &p->route[i];
480-
worst = delay;
481-
}
482-
}
483-
channel_hints_update(p, e->scid, e->direction, false, false, NULL,
484-
e->capacity, NULL);
485-
}
486-
487453
static struct amount_msat payment_route_fee(struct payment *p)
488454
{
489455
struct amount_msat fee;
@@ -956,7 +922,6 @@ static struct command_result *payment_getroute(struct payment *p)
956922

957923
/* Ensure that our fee and CLTV budgets are respected. */
958924
if (amount_msat_greater(fee, p->constraints.fee_budget)) {
959-
payment_exclude_most_expensive(p);
960925
p->route = tal_free(p->route);
961926
payment_fail(
962927
p, "Fee exceeds our fee budget: %s > %s, discarding route",
@@ -967,7 +932,6 @@ static struct command_result *payment_getroute(struct payment *p)
967932

968933
if (p->route[0].delay > p->constraints.cltv_budget) {
969934
u32 delay = p->route[0].delay;
970-
payment_exclude_longest_delay(p);
971935
p->route = tal_free(p->route);
972936
payment_fail(p, "CLTV delay exceeds our CLTV budget: %d > %d",
973937
delay, p->constraints.cltv_budget);

0 commit comments

Comments
 (0)