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

Make the `Cache` trait priv, just use `UnboundedCache` publicly

Public commit record

What the developer wrote

Authored by Matt Corallo

85/100 · Strong
Make the `Cache` trait priv, just use `UnboundedCache` publicly

In the previous commit, we moved to relying on
`BestBlock::previous_blocks` to find the fork point in
`lightning-block-sync`'s `init::synchronize_listeners`. Here we now
drop the `Cache` parameter as we no longer rely on it.

Because we now have no reason to want a persistent `Cache`, we
remove the trait from the public interface. However, to keep
disconnections reliable we return the `UnboundedCache` we built up
during initial sync from `init::synchronize_listeners` which we
expect developers to pass to `SpvClient::new`.
✓ 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 commit is a routine API cleanup, not a security fix. It removes a public `Cache` trait from the `lightning-block-sync` crate and forces all users to use the built-in `UnboundedCache`. The change simplifies the code and ensures that block headers collected during initial synchronization are reliably passed forward, avoiding a situation where a user-provided cache could lose headers needed to handle blockchain forks correctly.

Recommended action

No security action required. Developers using `rust-lightning` should update call sites: remove any custom `Cache` implementation, stop passing a cache reference to `synchronize_listeners`, and pass the returned `UnboundedCache` directly to `SpvClient::new`.

Security signals we found

01

API surface reduction: public `Cache` trait becomes crate-private

02

Removes user-provided cache parameter from `SpvClient::new` and `synchronize_listeners`

03

Eliminates `ReadOnlyCache` wrapper previously used to prevent cache eviction during multi-listener sync

04

Returns internally-built `UnboundedCache` from `synchronize_listeners` to preserve headers across sync and SPV polling

Risk score

Why this scored 22/100

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