Skip to content

Commit

Permalink
payalgo: Report reason to delay before clearing try memory.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ZmnSCPxj authored and rustyrussell committed May 8, 2018
1 parent 104645b commit c79b3de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lightningd/payalgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c79b3de

Please sign in to comment.