From 443643e0b0f48ff1ec1a80d0bc7424d296c8a1aa Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 6 Jul 2020 20:27:30 +0200 Subject: [PATCH] retrymod: Reset retry counter if parent is a split If the parent is a split we have new payment parameters, and want to perform a number of attempts with those. --- plugins/libplugin-pay.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index fff494f94..a88fb2bf6 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -1264,11 +1264,15 @@ retry_data_init(struct payment *p) { struct retry_mod_data *rdata = tal(p, struct retry_mod_data); struct retry_mod_data *parent_rdata; - if (p->parent != NULL) { + + /* We start the retry counter from scratch for the root payment, or if + * the parent was split, meaning this is a new attempt with new + * amounts. */ + if (p->parent == NULL || p->parent->step == PAYMENT_STEP_SPLIT) { + rdata->retries = 10; + } else { parent_rdata = payment_mod_retry_get_data(p->parent); rdata->retries = parent_rdata->retries - 1; - } else { - rdata->retries = 10; } return rdata; }