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

lightningd: register getwatchmanheight + chaininfo bwatch RPCs

Public commit record

What the developer wrote

Authored by Sangbida Chaudhuri

73/100 · Adequate
lightningd: register getwatchmanheight + chaininfo bwatch RPCs

Register the two startup RPCs that bwatch calls on launch:

- getwatchmanheight: bwatch asks how far we've already processed the
chain so it knows what height to (re)scan from. Returns
{height, blockhash?} from wm->last_processed_{height,hash}.
- chaininfo: bwatch reports the chain name, header/block counts, and
IBD status. We fatal() on a network mismatch (wrong bitcoind),
toggle bitcoind->synced based on IBD/header-vs-block lag, fire
notify_new_block on the transition to synced, and remember the
blockcount on watchman.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit adds two internal startup RPC endpoints used by a new component called bwatch. One endpoint reports how far the node has processed the blockchain; the other receives chain status from bwatch and updates the node's sync state. The code includes a safety check that shuts down the node if the connected Bitcoin backend is on the wrong network. There is no obvious vulnerability in the diff, but the commit is adding new RPC surface area and changing sync-state logic, which is security-relevant infrastructure.

Recommended action

Review whether these new RPCs are properly restricted to internal/bwatch callers (e.g., via plugin-only access, RPC allowlist, or Unix-socket binding). Verify that notify_new_block cannot be abused to trigger duplicate or premature block processing. Confirm that fatal() on network mismatch is the desired failure mode and cannot be triggered by a malicious or misconfigured bwatch.

Security signals we found

01

New RPC surface area registered (getwatchmanheight, chaininfo)

02

Fatal on network mismatch (chainparams->bip70_name)

03

Sync-state transition logic with notify_new_block firing

04

Direct mutation of bitcoind->synced and watchman->bitcoind_blockcount from RPC input

05

No visible access-control annotations in the diff

Risk score

Why this scored 27/100

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