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

Move to awaiting gossip validation in the background processor

Public commit record

What the developer wrote

Authored by Matt Corallo

81/100 · Strong
Move to awaiting gossip validation in the background processor

`P2PGossipSync` is a rather poor design. It currently basically
requires two circular `Arc` references, leaving `NetworkGraph`s to
leak if LDK is un-loaded:
* `P2PGossipSync` owns/holds a reference to the
`GossipVerifier` and `GossipVerifier` holds an `Arc` to the
`P2PGossipSync` and
* `PeerManager` holds a reference to the `P2PGossipSync` (as the
gossip message handler) which owns/holds a reference to the
`GossipVerifier`, which has a `Deref` (likely an `Arc` in
practice) to the `PeerManager`.

Instead, we should move towards the same design we have elsewhere -
hold a `Notifier` and expose waiting on it to the background
processor then poll for completion from there (in this case, as in
others by checking for completion when handling
`get_and_clear_pending_msg_events` calls).

After the last few commits of setup, here we finally switch to
waking the background processor directly when we detect async
gossip validation completion, allowing us to drop the circular
references in `P2PGossipSync`/`GossipVerifier` entirely.

Fixes #3369
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit refactors how Lightning Dev Kit handles background verification of gossip data (the routing information nodes share). Previously, the gossip verifier, the gossip sync component, and the peer manager held circular references to each other, which could prevent memory from being freed when LDK was unloaded. The change replaces those circular references with a notification mechanism: the background processor now waits directly for a 'validation completed' signal. This is primarily a memory-leak and architectural cleanup, not a direct exploit fix, but it removes a design that could keep resources alive unexpectedly.

Recommended action

Treat as a maintenance/refactoring patch with positive security side effects (resource cleanup). Reviewers should verify that the new validation_completion_future is always polled when P2PGossipSync is used, and that dropping the circular references does not introduce race conditions where validated gossip messages are not promptly forwarded. No immediate exploit mitigation is required.

Security signals we found

01

Circular reference removal between gossip verifier, P2PGossipSync, and PeerManager

02

Memory leak mitigation when LDK is unloaded (issue #3369)

03

Introduction of async notification primitive to avoid holding peer manager references in verifier

04

Refactoring only; no new cryptographic or network trust assumptions

Risk score

Why this scored 32/100

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