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

paymentsdb: add a wrapper to the fetchpayment method

Public commit record

What the developer wrote

Authored by ziggie

73/100 · Adequate
paymentsdb: add a wrapper to the fetchpayment method

We wrap the fetchPayment db call and catch the case where no errors
are found in the db, where we now return the ErrPaymentNotInitiated
error.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit refactors how LND's payment database looks up payments. It introduces a shared helper that converts a 'no rows found' database result into a specific, expected error (ErrPaymentNotInitiated). Several existing functions are switched to use this helper, and a few places that previously wrapped the raw database error with extra text now return the error directly. The change is mostly a cleanup, but it also tightens error handling so missing payments are treated consistently rather than as unexpected database failures.

Recommended action

Review whether callers of these payment DB methods handle ErrPaymentNotInitiated correctly, and consider applying the same wrapper to RegisterAttempt for consistency. No urgent patch is indicated by the diff alone.

Security signals we found

01

Missing-payment lookups now consistently return ErrPaymentNotInitiated instead of generic database errors

02

Raw sql.ErrNoRows is no longer propagated as an internal database failure

03

Error wrapping removed at some call sites, changing how errors surface to callers

04

RegisterAttempt still uses the unwrapped db.FetchPayment, leaving an inconsistency

Risk score

Why this scored 35/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 6/15
Affected reach 7/15
Confidence 6/10
Evidence quality 3/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.