Skip to content

Commit 675c518

Browse files
committed
fix(spv): clear stale SPV state and banner on RPC mode switch
When the backend switches from SPV to RPC without a full reset(), stale spv_no_peers_since and spv_connected_peers values could persist, causing the degraded timer to remain active incorrectly. Additionally, the SPV degraded banner was only managed inside the SPV mode branch, so switching away from SPV while the banner was showing would leave it stuck on screen. Fixes: 1. Clear SPV peer fields at the top of the RPC branch in refresh_zmq_and_spv(). 2. Clear the SPV degraded banner unconditionally when not in SPV mode.
1 parent 0de64dc commit 675c518

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/context/connection_status.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,14 @@ impl ConnectionStatus {
459459
}
460460
}
461461
CoreBackendMode::Rpc => {
462+
// Clear stale SPV state that may linger if the backend mode
463+
// switched from SPV to RPC without a full `reset()`.
464+
self.spv_connected_peers.store(0, Ordering::Relaxed);
465+
*self
466+
.spv_no_peers_since
467+
.lock()
468+
.unwrap_or_else(|e| e.into_inner()) = None;
469+
462470
// Update ZMQ status if there's a new event
463471
let disable_zmq = app_context
464472
.get_settings()

0 commit comments

Comments
 (0)