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

lightningd: use htable lock/unlock to ensure we don't add to htables while iterating.

Public commit record

What the developer wrote

Authored by Rusty Russell

85/100 · Strong
lightningd: use htable lock/unlock to ensure we don't add to htables while iterating.

Not all of them, but I've done the ones which weren't obvious.

Also, there's never a problem deleting during iteration, so remove places which
tried to "handle" that problem.

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

What changed, and why it matters

This change adds safety locks around hash table loops in Core Lightning so the code cannot accidentally insert new entries while it is still walking through the same table. It also removes some old 'rerun' work-arounds that were meant to cope with entries being skipped during deletion. The patch is a hardening fix: it makes the daemon more robust against internal corruption or crashes caused by modifying a hash table while iterating over it, but it does not by itself add or remove any user-facing feature.

Recommended action

Treat as a stability and defensive-security improvement. Review remaining htable iteration sites that the author describes as not yet covered. Verify that the lock/unlock primitives are present in the build and that assertions are enabled in release builds, otherwise the protection may be a no-op.

Security signals we found

01

Hash-table iterator invalidation hardening

02

Addition-during-iteration now asserted against via lock/unlock

03

Removal of defensive rerun loops based on assumption that deletion-during-iteration is safe

04

Memory-safety / crash-avoidance class fix

Risk score

Why this scored 44/100

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