-
Notifications
You must be signed in to change notification settings - Fork 12
fix(spv): clear stale SPV state and banner on RPC mode switch #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v1.0-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -459,6 +459,14 @@ impl ConnectionStatus { | |
| } | ||
| } | ||
| CoreBackendMode::Rpc => { | ||
| // Clear stale SPV state that may linger if the backend mode | ||
| // switched from SPV to RPC without a full `reset()`. | ||
| self.spv_connected_peers.store(0, Ordering::Relaxed); | ||
| *self | ||
| .spv_no_peers_since | ||
| .lock() | ||
| .unwrap_or_else(|e| e.into_inner()) = None; | ||
|
Comment on lines
461
to
+468
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: RPC cleanup doesn't reset spv_status — stale Stopping state affects poll cadence The new RPC branch clears Consider adding source: ['codex-general', 'claude-general'] 🤖 Fix this with AI agents |
||
|
|
||
| // Update ZMQ status if there's a new event | ||
| let disable_zmq = app_context | ||
| .get_settings() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset
spv_statusin RPC branch to prevent stale fast-refresh cadence.At Line [444]-Line [450], peer-related SPV fields are cleared, but
spv_statusis not. Since Line [394] usesspv_status == Stoppingto force a 200ms refresh interval, switching to RPC during SPV shutdown can leave RPC polling stuck at the fast cadence and spamGetBestChainLocks.Proposed minimal fix
CoreBackendMode::Rpc => { // Clear stale SPV state that may linger if the backend mode // switched from SPV to RPC without a full `reset()`. + self.set_spv_status(SpvStatus::Idle); self.spv_connected_peers.store(0, Ordering::Relaxed); *self .spv_no_peers_since .lock() .unwrap_or_else(|e| e.into_inner()) = None;🤖 Prompt for AI Agents