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

bwatch: detect reorgs and roll back tip

Public commit record

What the developer wrote

Authored by Sangbida Chaudhuri

68/100 · Adequate
bwatch: detect reorgs and roll back tip

When handle_block fetches the next block, validate its parent hash
against our current tip. If they disagree we're seeing a reorg: pop our
in-memory + persisted tip via bwatch_remove_tip, walk the history one
back, and re-fetch from the new height. Each fetch may itself reorg
further, so the loop naturally peels off as many stale tips as needed
until the chain rejoins.

After every rollback, tell watchman the new tip via
revert_block_processed so its persisted height tracks bwatch's. If we
crash before the ack lands, watchman's stale height will be higher than
ours on restart, which retriggers the rollback.

If the rollback exhausts our history (we rolled back past the oldest
record we still hold) we zero current_height/current_blockhash and let
the next poll re-init from bitcoind's tip.

Notifying owners that their watches were reverted lands in a subsequent
commit.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit adds blockchain reorganization (reorg) handling to Core Lightning's 'bwatch' plugin. A reorg happens when the Bitcoin network temporarily replaces a known block with a different one. Previously, bwatch appears to have blindly trusted each new block's parent hash, which could have left the plugin tracking an invalid or forked chain. The patch detects mismatched parent hashes, rolls back its internal tip one block at a time, and tells another component ('watchman') to do the same. It is a defensive correctness fix rather than an active exploit patch; the commit message notes that notifying users whose transactions were affected is deferred to a later commit.

Recommended action

Treat as a correctness/hardening improvement that should be included in the next maintenance release. Review the follow-up commit that notifies owners of reverted watches, since user-visible notification is the remaining security-relevant gap. Operators running nodes that depend on bwatch should upgrade to obtain reorg-safe tip tracking.

Security signals we found

01

Adds missing blockchain reorg detection and rollback in a block-tracking plugin

02

Previously accepted new blocks without verifying parent hash against current tip

03

Crash-recovery design depends on watchman persisting a stale higher height to retrigger rollback

04

Deferred user/owner notification of reverted watches to a follow-up commit

05

No explicit CVE, advisory, or researcher attribution in commit or supplied references

Risk score

Why this scored 46/100

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