payments/db: fix silent error in duplicate payment lookup

When duplicatePaymentSequenceKey is missing from a duplicate payment
sub-bucket, the code returned the outer function's err variable which
is nil at that point. This caused corrupted duplicate entries to be
silently treated as "not found" instead of failing loudly.

Return a new dedicated ErrNoDuplicateSequenceNumber error so malformed
data is detected immediately.
This commit is contained in:
ziggie committed 2026-02-25 18:52:34 +01:00
1 parent c862e70148
commit 9def124380
2 files changed
+6 -1

No files matched your search

+1 -1
View File
@@ -1236,7 +1236,7 @@ func fetchPaymentWithSequenceNumber(tx kvdb.RTx, paymentHash lntypes.Hash,
seqBytes := subBucket.Get(duplicatePaymentSequenceKey)
if seqBytes == nil {
return err
return ErrNoDuplicateSequenceNumber
}
// If this duplicate payment is not the sequence number we are