Report LSPS2 fallback persistence
What changed, and why it matters
This one-line change fixes a bookkeeping bug in the LSPS2 (Lightning Service Provider Specification 2) service code. Previously, when the code had to force-save a peer's state before removing that peer, it performed the save but forgot to record that it had done so. Now it correctly reports 'yes, we persisted that state.' The main risk is that downstream logic relying on this flag could make wrong decisions—such as skipping a needed re-persistence, incorrectly pruning state, or reporting an inaccurate status to the caller.
Treat as a low-to-moderate reliability/security fix. Review callers of this function to confirm they handle did_persist correctly, and include this change in the next maintenance release. No immediate emergency response is indicated unless downstream components are shown to make security-critical decisions based on did_persist.
Security signals we found
State-tracking inconsistency between actual persistence and reported persistence flag
Potential for downstream logic to act on stale/incorrect persistence status
Fix located in LSPS2 service provider state-pruning code path
Evidence from the diff
In lightning-liquidity/src/lsps2/service.rs, inside the peer-state pruning path, the code calls persist_peer_state(counterparty_node_id).await? when a prunable peer has already gained state before removal. The patch adds did_persist = true after that call. Without this assignment, the function’s return value (or later logic using did_persist) would falsely indicate that no persistence occurred, even though the store was actually written. This is a state-consistency/reporting fix; it does not by itself introduce a remote exploit, but it removes a condition where internal state tracking diverges from actual storage behavior.
Changed components
lightning-liquidity/src/lsps2/service.rsLSPS2 service provider peer-state persistence and pruning logicInspect captured patch +1 / −0
diff --git a/lightning-liquidity/src/lsps2/service.rs b/lightning-liquidity/src/lsps2/service.rs
index b52d12e..8bea100 100644
--- a/lightning-liquidity/src/lsps2/service.rs
+++ b/lightning-liquidity/src/lsps2/service.rs
@@ -1861,6 +1861,7 @@ where
did_persist = true;
} else {
self.persist_peer_state(counterparty_node_id).await?;
+ did_persist = true;
}
}
Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.