From 0b85b983accd5cfd288c0a6313eee8a55277ca4d Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 22 May 2020 17:44:47 +0200 Subject: [PATCH] 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. --- plugins/libplugin-pay.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 92793a912..ae26dea4d 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -809,6 +809,12 @@ static inline void retry_step_cb(struct retry_mod_data *rd, { struct payment *subpayment; 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) { subpayment = payment_new(p, NULL, p, p->modifiers); payment_start(subpayment);