multi: move failed attempt cfg option to the router subsytem

Previously we had db and application logic mixed on the db level.
We now move the config option KeepFailedPaymentAttempts to the
ChannelRouter level and move it out of the db level.
This commit is contained in:
ziggie committed 2026-02-25 08:02:26 +01:00
1 parent 253e4fd832
commit 995ad7e1b5
10 files changed
+224 -175

No files matched your search

+10 -9
View File
@@ -338,15 +338,16 @@ lifecycle:
// terminal condition. We either return the settled preimage or the
// payment's failure reason.
//
// Optionally delete the failed attempts from the database. Depends on
// the database options deleting attempts is not allowed so this will
// just be a no-op.
err = p.router.cfg.Control.DeleteFailedAttempts(
cleanupCtx, p.identifier,
)
if err != nil {
log.Errorf("Error deleting failed htlc attempts for payment "+
"%v: %v", p.identifier, err)
// Optionally delete the failed attempts from the database. If we are
// configured to keep failed payment attempts, we skip deletion.
if !p.router.cfg.KeepFailedPaymentAttempts {
err = p.router.cfg.Control.DeleteFailedAttempts(
cleanupCtx, p.identifier,
)
if err != nil {
log.Errorf("Error deleting failed htlc attempts "+
"for payment %v: %v", p.identifier, err)
}
}
htlc, failure := payment.TerminalInfo()