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

wallet: add migrate_backfill_bwatch_tables

Public commit record

What the developer wrote

Authored by Sangbida Chaudhuri

70/100 · Adequate
wallet: add migrate_backfill_bwatch_tables

Populate our_outputs/our_txs from the legacy outputs/transactions
tables so the bwatch wallet path starts with the same state as the
existing wallet.

Use outputs rather than utxoset because it already contains only
wallet-owned rows and carries wallet metadata like reservations and
channel-close info.

Downgrade only drops the new tables: later commits keep mirroring
writes into the legacy tables, so no copy-back migration is needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
✓ Descriptive subject✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit adds a database migration that copies existing wallet data into new tables used by an upcoming 'bwatch' wallet component. It is a data backfill, not a code fix for an active vulnerability. The main risk is that if the migration copies data incorrectly, a future version of Core Lightning could misread the wallet state—potentially showing wrong balances, missing transactions, or in rare cases making unsafe spending decisions. The commit includes tests that check the copy logic for several common cases.

Recommended action

Review the column mapping carefully during normal code review, run the included unit test, and verify that the new bwatch wallet code treats the sentinel values (blockheight 0, txindex 0/1) consistently. No emergency action is indicated.

Security signals we found

01

Database migration touching wallet UTXO and transaction tables

02

Potential for data inconsistency if mapping logic is wrong

03

ON CONFLICT DO NOTHING prevents overwrite but could hide duplicate-key anomalies

04

No input validation or bounds checks on migrated values

05

No vendor statement that this is a security fix

Risk score

Why this scored 28/100

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