paymod: Teach the retry_mod not to insist when it's futile

An important life lesson: if there is no path to happiness, then trying harder
will still not get you there.
This commit is contained in:
Christian Decker 2020-05-22 17:44:47 +02:00
parent 10f231bcb5
commit 0b85b983ac

View File

@ -809,6 +809,12 @@ static inline void retry_step_cb(struct retry_mod_data *rd,
{ {
struct payment *subpayment; struct payment *subpayment;
struct retry_mod_data *rdata = payment_mod_retry_get_data(p); struct retry_mod_data *rdata = payment_mod_retry_get_data(p);
/* If we failed to find a route, it's unlikely we can suddenly find a
* new one without any other changes, so it's time to give up. */
if (p->step == PAYMENT_STEP_FAILED && p->route == NULL)
payment_continue(p);
if (p->step == PAYMENT_STEP_FAILED && rdata->retries > 0) { if (p->step == PAYMENT_STEP_FAILED && rdata->retries > 0) {
subpayment = payment_new(p, NULL, p, p->modifiers); subpayment = payment_new(p, NULL, p, p->modifiers);
payment_start(subpayment); payment_start(subpayment);