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

paymentsdb: preserve AMP attempt hashes in sql store

Public commit record

What the developer wrote

Authored by yyforyongyu

95/100 · Strong
paymentsdb: preserve AMP attempt hashes in sql store

Live SQL writes stored the payment identifier in payment_hash for
each attempt. That works for legacy payments, but it breaks AMP
because the payment identifier is the SetID while each shard carries
its own HTLC hash.

Use TestRegisterAttemptPreservesAttemptHash as evidence. The test now
passes on both KV and SQL.

Fix this by persisting attempt.Hash when it is present and only
falling back to the payment identifier when the attempt hash is nil.
That restores KV parity for AMP attempt reloads.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a database bug in LND's new SQL payment store. For a special payment type called AMP (Atomic Multi-Path), each individual payment shard has its own unique hash, but the SQL store was incorrectly saving the overall payment identifier (the SetID) as the hash for every shard. This meant that when LND later reloaded AMP payment attempts from the SQL database, the per-shard hashes were wrong, which could break retry logic, correlation of HTLCs, or reporting. The fix saves the shard's own hash when available, and only falls back to the payment identifier when there is no shard hash. It is a data-integrity bug, not a direct funds-loss vulnerability, and only affects users running the experimental SQL backend.

Recommended action

Treat as a data-integrity bug fix rather than a security vulnerability. Users running the SQL payment store backend should upgrade to avoid incorrect AMP attempt-hash reloads, which could affect payment tracking and retry behavior. No immediate emergency response is indicated by the commit materials.

Security signals we found

01

Data integrity mismatch between runtime object and persisted SQL row

02

AMP-specific incorrect hash persistence in SQL backend only

03

Test added/updated to enforce parity with KV store behavior

04

No mention of funds loss, remote exploit, or cryptographic failure

Risk score

Why this scored 43/100

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