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

paymentsdb: add inflight recovery regression tests

Public commit record

What the developer wrote

Authored by yyforyongyu

83/100 · Strong
paymentsdb: add inflight recovery regression tests

SQL FetchInFlightPayments only returns payments with an unresolved
attempt row. KV returns every non-terminal payment, including
retryable payments with only failed attempts and payments that have
been initialized but have not registered any HTLCs yet.

Add TestFetchInFlightPaymentsIncludesRetryablePayments and
TestFetchInFlightPaymentsIncludesInitiatedPayments as evidence. Both
tests pass on KV and fail on SQL before the fix.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit only adds new regression tests to LND's payment database. The tests document that the SQL database backend previously failed to return certain kinds of non-finished (retryable or just-started) payments when asked for in-flight payments, while the older KV backend returned them correctly. The commit itself does not contain the actual fix; it only adds tests that would have failed before the fix. The practical risk is that recovery or routing logic relying on FetchInFlightPayments could miss payments it should retry or monitor, but no direct funds-loss vulnerability is shown in the diff.

Recommended action

Review the companion fix commit that makes these new tests pass on the SQL backend, and verify that FetchInFlightPayments in the SQL implementation now returns payments in StatusInitiated and StatusInFlight with only failed attempts. Ensure recovery and retry logic does not skip these payments in production.

Security signals we found

01

Behavioral discrepancy between SQL and KV database backends for payment lifecycle state

02

Potential omission of retryable/initiated payments from in-flight recovery queries

03

Regression-test-only commit; actual fix is elsewhere

04

No direct cryptographic, network, or access-control weakness in the diff

Risk score

Why this scored 37/100

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