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

wallet: don't insert duplicate chain_moves entries after accounts.db migration.

Public commit record

What the developer wrote

Authored by Rusty Russell

73/100 · Adequate
wallet: don't insert duplicate chain_moves entries after accounts.db migration.

When we migrate from accounts.db, we use the `account_nonchannel_id`
field. But we can replay the block chain and the channel involved is
still open, we will use the `account_channel_id` field, and our duplicate
detection fails.

As a result, we can end up with duplicate entries in the database, which
make accounting incorrect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `listchainmoves` could contain bogus duplicate entries after 25.09 bookkeeper migration.
✓ 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 Core Lightning's accounting/bookkeeping system where the same on-chain money movement could be recorded twice in the database after a migration. The bug happens because the code looked for duplicates using one account identifier, but after a migration or replay it could store the same event under a different identifier. The fix makes duplicate detection check both possible identifiers. It is a data-integrity bug, not a security vulnerability that an attacker can exploit.

Recommended action

Treat as a routine bug fix. Users relying on accounting reports should upgrade and may need to audit or rebuild chain_moves data if duplicates were already introduced. No emergency security response is warranted.

Security signals we found

01

Data integrity / accounting correctness bug

02

Duplicate database rows possible after migration

03

No input validation or memory safety issue

04

No attacker-controlled code path identified

Risk score

Why this scored 28/100

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