Skip to content

Commit 4ffd5e2

Browse files
committed
pay: work around bug #1212 for existing databases.
Signed-off-by: Rusty Russell <[email protected]>
1 parent 1b9791f commit 4ffd5e2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lightningd/pay.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,17 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
431431
&hout->payment_hash);
432432

433433
#ifdef COMPAT_V052
434+
/* Prior to "pay: delete HTLC when we delete payment." we would
435+
* delete a payment on retry, but leave the HTLC. */
436+
if (!payment) {
437+
log_unusual(hout->key.channel->log,
438+
"No payment for %s:"
439+
" was this an old database?",
440+
type_to_string(tmpctx, struct sha256,
441+
&hout->payment_hash));
442+
return;
443+
}
444+
434445
/* FIXME: Prior to 299b280f7, we didn't put route_nodes and
435446
* route_channels in db. If this happens, it's an old payment,
436447
* so we can simply mark it failed in db and return. */

0 commit comments

Comments
 (0)