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

lightningd: change watch_scriptpubkey and watch_blockdepth not to insert exact duplicates.

Public commit record

What the developer wrote

Authored by Rusty Russell

83/100 · Strong
lightningd: change watch_scriptpubkey and watch_blockdepth not to insert exact duplicates.

This double-watching is in fact invoked for splicing (on restart, see
tests/test_splicing.py::test_commit_crash_splice) and the "not
creating duplicates" API mirrors the future bwatch API which is persistent.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This change prevents Core Lightning from registering the same blockchain watch twice. Duplicate watches could cause the same callback to fire multiple times, which during splicing (a way to resize a Lightning channel) after a restart could confuse internal bookkeeping. The patch makes the watch functions return false when an identical watch already exists and removes an unused memory-handling marker from the unwatch function.

Recommended action

Treat as a hardening/correctness fix rather than an urgent security patch. Review callers of watch_scriptpubkey and watch_blockdepth to ensure they handle the new false return value correctly and do not rely on duplicate registrations. Include the referenced splicing restart test in regression suite.

Security signals we found

01

Duplicate callback registration could lead to double-triggering of event handlers

02

Splicing restart path explicitly mentioned as invoking double-watching

03

Memory ownership annotation TAKES removed from unwatch API, indicating prior misuse risk

04

No explicit CVE, advisory, or security disclosure in commit or references

Risk score

Why this scored 32/100

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