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:
2 files changed
+6
-1
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user