AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 42 Bitcoin

payments/db: fix silent error in duplicate payment lookup

Public commit record

What the developer wrote

Authored by ziggie

73/100 · Adequate
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.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in LND's payment database where a missing piece of data inside a stored duplicate payment was silently treated as 'not found' instead of reporting an error. The fix makes the database return a clear, dedicated error so corrupted or malformed payment records are detected immediately rather than ignored.

Recommended action

Apply the patch. Audit related duplicate-payment lookup paths for similar shadowing of err variables. Consider adding regression tests that simulate a missing duplicatePaymentSequenceKey and assert ErrNoDuplicateSequenceNumber is returned.

Security signals we found

01

Silent error swallowing in database lookup

02

Potential data-integrity issue in payment storage

03

Missing key in nested bucket treated as benign

04

Fix converts silent failure to explicit error

Risk score

Why this scored 42/100

Our methodology →
Potential impact 12/30
Exploitability 5/25
Stealth signal 8/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.