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

Don't prune `pending_requests` in `persist`

Public commit record

What the developer wrote

Authored by Elias Rohrer

68/100 · Adequate
Don't prune `pending_requests` in `persist`

Previously, we would also prune any pending `GetInfo` or expired `Buy`
requests before we `persist`. This could have lead to races where we
drop a pending request and even remove the peer when calling `persist`.

Here, we simply split the pruning logic for the `pending_requests` and
expired JIT channel state, and only prune the latter before persisting.
This generally makes sense, as `pending_requests` isn't currently
persisted, so there is no need to prune before repersisting.

Both are however still pruned on peer disconnection.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes a race condition in a Lightning service's save-to-disk routine. Previously, the code would clean up certain in-flight peer requests right before saving state, which could accidentally drop a valid request and even disconnect a peer. Now, cleanup of those in-flight requests is done only when a peer disconnects, while saving only cleans up truly expired channel state. The fix reduces the chance of legitimate requests being lost or peers being wrongly removed.

Recommended action

Review the persist and peer-disconnection paths to confirm no other combined cleanup remains. Add regression tests that simulate an in-flight GetInfo/Buy request during persist to ensure the request and peer are not dropped. Monitor for any follow-up fixes in this area.

Security signals we found

01

Race condition between request pruning and state persistence

02

Potential accidental peer removal during persist

03

In-flight LSPS2 GetInfo/Buy request loss

04

Separation of volatile request cleanup from persisted state cleanup

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.