From 39248b5fa70d1ee0875c1cf71d7a5051f2f23093 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 31 May 2021 12:41:45 +0200 Subject: [PATCH] pay: Do not delete old sendpay attempts if we retry This was the main cause of the pay states flip-flopping, since we reset the status on each attempt any final status is not really final. Let's keep them around, and provide a stable history. --- lightningd/pay.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lightningd/pay.c b/lightningd/pay.c index f4dd83b19..e2593e6c3 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -1033,13 +1033,12 @@ send_payment_core(struct lightningd *ld, "First peer not ready")); } - /* If we're retrying, delete all trace of previous one. We delete - * outgoing HTLC, too, otherwise it gets reported to onchaind as - * a possibility, and we end up in handle_missing_htlc_output-> - * onchain_failed_our_htlc->payment_failed with no payment. + /* If we're retrying we delete outgoing HTLC otherwise it gets + * reported to onchaind as a possibility, and we end up in + * handle_missing_htlc_output -> onchain_failed_our_htlc -> + * payment_failed with no payment. */ if (old_payment) { - wallet_payment_delete(ld->wallet, rhash, partid); wallet_local_htlc_out_delete(ld->wallet, channel, rhash, partid); }