From c79b3de4d69694ee925d1735442b50d6750d1a82 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Mon, 7 May 2018 14:19:51 +0000 Subject: [PATCH] payalgo: Report reason to delay before clearing try memory. We allocate the reason to delay, if any, from the `pay->try_parent`. So we should not clear the `pay->try_parent` until after we print the reason. --- lightningd/payalgo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lightningd/payalgo.c b/lightningd/payalgo.c index 5b704f86a..66f953d57 100644 --- a/lightningd/payalgo.c +++ b/lightningd/payalgo.c @@ -344,12 +344,13 @@ static void json_pay_sendpay_resolve(const struct sendpay_result *r, if (why) { /* We have some reason to delay retrying. */ + log_info(pay->cmd->ld->log, + "pay(%p): Delay before retry: %s", pay, why); + /* Clear previous try memory. */ pay->try_parent = tal_free(pay->try_parent); pay->try_parent = tal(pay, char); - log_info(pay->cmd->ld->log, - "pay(%p): Delay before retry: %s", pay, why); /* Delay for 3 seconds if needed. FIXME: random * exponential backoff */ new_reltimer(&pay->cmd->ld->timers, pay->try_parent,