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

wallet: record bwatch-discovered wallet outputs

Public commit record

What the developer wrote

Authored by Sangbida Chaudhuri

68/100 · Adequate
wallet: record bwatch-discovered wallet outputs

Add the wallet helpers and watch handlers that turn a bwatch
scriptpubkey match into our_txs and our_outputs rows. They validate
the matching output, notify invoice accounting, record confirmed
deposits, and install watches for later spends.

The watch_revert handler demotes the rows back to unconfirmed (the 0
sentinel) rather than deleting them: a row also carries state a
rediscovery cannot restore (reserved_til, onchaind close metadata),
and the still-armed watches re-promote it if the tx confirms again.
This matches the legacy tables, whose blocks(height) foreign keys
demote rows to NULL when the block row is removed.

Unlike got_utxo(), this path does not write transaction_annotations:
nothing reads per-transaction annotations anymore, so only the legacy
scanner keeps populating them (for downgrade, like the other legacy
tables).

The watchman dispatch entry is wired in the following commit. Keep this
path alongside got_utxo() and wallet_transaction_add(): the legacy
scanner must continue populating outputs and transactions for one release
so downgrades do not require a rescan.

Co-authored-by: Cursor <cursoragent@cursor.com>
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit adds new wallet bookkeeping code for Core Lightning. It records Bitcoin deposits found by a new chain-watcher ('bwatch') into database tables and handles blockchain reorganizations by demoting transactions back to unconfirmed rather than deleting them. It is a feature/refactoring commit, not a fix for a known vulnerability, and the commit message does not describe any security issue.

Recommended action

Review as normal feature/refactoring code. Pay attention to the new SQL write paths, reorg demotion logic, and owner-string parsing to ensure no injection, race-condition, or data-loss bugs were introduced. No immediate security response is indicated by the commit itself.

Security signals we found

01

New database write paths for wallet UTXOs and transactions

02

Reorg revert logic demotes rather than deletes rows to preserve metadata

03

Owner-string constructors added to avoid silent unwatch failures from format mismatches

04

ScriptPubKey validation rejects unrecognized wallet scripts

05

Elements non-main asset outputs are explicitly ignored

06

No mention of vulnerability, CVE, or security fix in commit message

Risk score

Why this scored 32/100

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