Merge PR 'Persist LSPS2 deferred funding transaction and broadcast authorization' (#5487)
What changed, and why it matters
This small patch fixes a state-persistence bug in a Lightning service feature (LSPS2). When a funding transaction or broadcast authorization was recorded, the code forgot to mark the peer's state as needing to be saved to disk. That could let the in-memory change disappear after a restart, potentially causing the node to lose track of money-moving transactions or re-broadcast at the wrong time. It is a reliability/consistency fix rather than an obvious remote exploit.
Treat as a low-to-moderate reliability fix. Users running LSPS2 service code should upgrade to avoid state inconsistency that could affect channel funding behavior after a restart. No immediate emergency response is indicated from the diff alone.
Security signals we found
State mutation without persistence flag
Potential inconsistency between in-memory JIT channel state and on-disk state after restart
Missing durability for funding transaction authorization in LSPS2 flow
Evidence from the diff
In lightning-liquidity/src/lsps2/service.rs, two methods that mutate a JIT channel—set_funding_tx and set_funding_tx_broadcast_safe—now set peer_state.needs_persist = true after calling broadcast_funding_transaction_if_applies. Previously the mutation could be held only in memory and not flushed to persistent storage, risking state inconsistency across restarts. The change is defensive and aligns with the module’s existing persistence pattern.
Changed components
lightning-liquidity/src/lsps2/service.rsLSPS2 service handlerJIT channel state persistenceInspect captured patch +2 / −0
### lightning-liquidity/src/lsps2/service.rs
@@ -2062,6 +2062,7 @@ where
jit_channel.set_funding_tx(funding_tx);
self.broadcast_funding_transaction_if_applies(jit_channel);
+ peer_state.needs_persist = true;
Ok(())
}
@@ -2111,6 +2112,7 @@ where
jit_channel.set_funding_tx_broadcast_safe(true);
self.broadcast_funding_transaction_if_applies(jit_channel);
+ peer_state.needs_persist = true;
Ok(())
}
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.