fix: add 30-second timeout to SPV quorum public key lookup#621
fix: add 30-second timeout to SPV quorum public key lookup#621thepastaclaw wants to merge 2 commits intodashpay:v1.0-devfrom
Conversation
Wrap the quorum public key lookup in a 30-second timeout to prevent indefinite hangs when the SPV client is unresponsive or the network request stalls. Returns a clear timeout error message with context. Cherry-picked from ralph/improvements (commit 9c17988).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change adds a 30-second timeout mechanism to the SPV quorum lookup call in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Addressed Lukasz's feedback by removing the unnecessary Validation re-run on current branch:
|
xdustinface
left a comment
There was a problem hiding this comment.
Has this been an issue? I wonder why this would be needed. There is no network request involved here its just a lookup in the masternode list.
|
Also btw, you don't seem to be on a recent commit of rust-dashcore? The client interface doesn't exist anymore. The |
|
Good point — the current I'll open a tracker issue to bump the rust-dashcore dependency separately. Thanks for the heads up! |
|
You're right that the underlying operation is a local masternode list lookup — no network round-trip. But the call goes through The timeout is defensive against the command channel hanging, not against network latency. 30 seconds is generous enough to never trigger during normal operation, but prevents a silent hang from becoming a frozen UI. That said, if you think the command channel pattern itself is robust enough that this can't happen in practice, happy to hear that — you know the SPV internals better than I do. |
Wrap the SPV quorum public key lookup in a 30-second timeout to prevent indefinite hangs.
Problem
get_quorum_public_keycallsget_quorum_by_heighton the SPV client interface with no timeout. If the SPV client is unresponsive or the network request stalls, this blocks the calling thread indefinitely (it runs insideblock_in_place/block_on).Fix
Wrap the async lookup in
tokio::time::timeout(Duration::from_secs(30), ...). On timeout, a descriptive warning is logged and a clear error is returned with the quorum type, hash, and height for debugging.30 seconds is generous for a quorum lookup — normal responses arrive in under a second.
Cherry-picked from
ralph/improvements(commit 9c17988).Validation
What was tested:
cargo clippy --all-features --all-targets -- -D warnings— lint checkcargo test --all-features --workspace— full workspace test suiteResults:
ClippyCI check — pass (5m49s)Test SuiteCI check — pass (7m52s)Environment: Local macOS arm64; GitHub Actions CI (ubuntu-latest)
Summary by CodeRabbit