Skip to content

fix(spv): clear stale SPV state and banner on backend mode switch#669

Closed
thepastaclaw wants to merge 1 commit intodashpay:v1.0-devfrom
thepastaclaw:fix/spv-state-leak-on-mode-switch
Closed

fix(spv): clear stale SPV state and banner on backend mode switch#669
thepastaclaw wants to merge 1 commit intodashpay:v1.0-devfrom
thepastaclaw:fix/spv-state-leak-on-mode-switch

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

Issue

When switching from SPV to RPC backend mode, two related issues could leave stale SPV state visible to the user:

  1. Stale SPV state leak (Medium): refresh_zmq_and_spv() enters the Rpc branch but never clears spv_no_peers_since or spv_connected_peers. If the mode switch happens without a full reset(), the degraded peer timer persists.

  2. Banner not cleared on mode switch (Low-Medium): The SPV degraded banner is only managed inside if core_backend_mode() == Spv. Switching away while the banner is showing leaves it stuck.

Found in code review of #658.

Changes

  • connection_status.rs: Clear spv_connected_peers and spv_no_peers_since at the top of the Rpc branch in refresh_zmq_and_spv().
  • app.rs: Add an else branch to unconditionally clear the SPV degraded banner when not in SPV mode.

Testing

cargo check passes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thepastaclaw
Copy link
Copy Markdown
Collaborator Author

Duplicate of #668 — I opened this without checking that Codex had already created a PR. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant