-
Notifications
You must be signed in to change notification settings - Fork 10
Chore: error cleanup #364
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: v0.42-dev
Are you sure you want to change the base?
Chore: error cleanup #364
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughThis pull request consolidates error handling by renaming Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
dash-spv/src/client/sync_coordinator.rs (1)
413-430: Handle failures fromupdate_chainlock_validation.Errors are silently ignored right now, which can leave ChainLock validation disabled without any signal. Consider logging or surfacing the failure.
💡 Suggested handling
- if let Ok(has_engine) = self.update_chainlock_validation().await { - if has_engine { + match self.update_chainlock_validation().await { + Ok(has_engine) => { + if has_engine { masternode_engine_updated = true; tracing::info!( "✅ Masternode sync complete - ChainLock validation enabled" ); // Validate any pending ChainLocks if let Err(e) = self.validate_pending_chainlocks().await { tracing::error!( "Failed to validate pending ChainLocks after masternode sync: {}", e ); } - } - } + } + } + Err(e) => { + tracing::warn!("Failed to update ChainLock validation state: {}", e); + } + }dash-spv/src/chain/chainlock_manager.rs (2)
179-217: Drop the masternode-engine lock before awaiting queueing.
queue_pending_chainlock().await(lines 200 and 213) runs while themasternode_engineread guard is held. The comment "engine_guard dropped before any await" is incorrect—the guard persists across both await calls until line 217. Clone theOption<Arc<_>>first in a scoped block, then await without holding the lock.🔧 Example refactor
- let engine_guard = self.masternode_engine.read().await; - - if let Some(engine) = engine_guard.as_ref() { + let engine = { self.masternode_engine.read().await.clone() }; + if let Some(engine) = engine.as_ref() { // Use the masternode engine's verify_chain_lock method match engine.verify_chain_lock(&chain_lock) { Ok(()) => { @@ if error_string.contains("No masternode lists in engine") { @@ - self.queue_pending_chainlock(chain_lock.clone()).await; + self.queue_pending_chainlock(chain_lock.clone()).await; } else { return Err(ValidationError::InvalidChainLock(format!( "MasternodeListEngine validation failed: {:?}", e ))); } } } } else { // Queue for later validation when engine becomes available warn!( "⚠️ Masternode engine not available, queueing ChainLock for later validation" ); - self.queue_pending_chainlock(chain_lock.clone()).await; + self.queue_pending_chainlock(chain_lock.clone()).await; } - } // engine_guard dropped before any await + } // guard already dropped before awaits
90-125: Don't hold the pending-chainlocks write lock across awaits.
validate_pending_chainlocksacquires a write lock and holds it while callingself.process_chain_lock(...).awaitin a loop. Ifprocess_chain_lockencounters missing masternode list data, it callsself.queue_pending_chainlock(...), which attempts to re-acquire the same lock from the same task. Tokio'sRwLockis not reentrant, causing a deadlock.Drain the pending queue before awaiting by using
std::mem::take(&mut *pending)immediately after acquiring the lock, then drop the lock before processing.
🤖 Fix all issues with AI agents
In `@dash-spv/src/error.rs`:
- Around line 168-169: Update the doc comment for the Result type alias so it
references the current Error type name instead of the old "SpvError"; locate the
declaration of the alias named Result and change its comment to something like
"Type alias for Result with Error." ensuring the documentation matches the
actual Error type used by the alias.
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
b6f854e to
1b21f7d
Compare
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
dash-spv/src/chain/chainlock_manager.rs (1)
90-127: Potential deadlock when processing pending chainlocks.The write lock on
pending_chainlocksis acquired at line 95 and held throughout the iteration. However,process_chain_lock(called at line 103) can invokequeue_pending_chainlock(at lines 201, 215), which attempts to acquire a write lock on the samepending_chainlocks. Withtokio::sync::RwLock, this will cause the task to block forever waiting for a lock it already holds.Additionally, a write lock is acquired but only read operations (
.iter()) are performed.🔒 Proposed fix: Clone pending items and use read lock, or drain before processing
pub async fn validate_pending_chainlocks<S: StorageManager>( &self, chain_state: &ChainState, storage: &mut S, ) -> ValidationResult<()> { - let pending = self.pending_chainlocks.write().await; + // Drain pending chainlocks to avoid holding lock during async processing + let pending: Vec<ChainLock> = { + let mut guard = self.pending_chainlocks.write().await; + std::mem::take(&mut *guard) + }; info!("Validating {} pending ChainLocks", pending.len()); let mut validated_count = 0; let mut failed_count = 0; - for chain_lock in pending.iter() { + for chain_lock in pending.into_iter() { - match self.process_chain_lock(chain_lock.clone(), chain_state, storage).await { + match self.process_chain_lock(chain_lock, chain_state, storage).await {
🧹 Nitpick comments (4)
dash-spv/src/sync/manager.rs (1)
10-11: LGTM!The import path update to use
crate::SyncResultis consistent with the error consolidation. Minor nitpick: lines 10-11 could be consolidated into a single import statement:-use crate::SyncResult; -use crate::{SpvStats, SyncError}; +use crate::{SpvStats, SyncError, SyncResult};dash-spv/src/storage/chainstate.rs (1)
5-9: Use the re-exportedStorageResulttype alias for consistency.Line 6 imports
StorageResultfromcrate::error, butStorageResultis re-exported at the crate root inlib.rs(line 81). Other storage files (storage/mod.rs,storage/blocks.rs) import it directly ascrate::StorageResult. Update the import for consistency:use crate::{ - error::StorageResult, + StorageResult, storage::{io::atomic_write, PersistentStorage}, ChainState, };dash-spv-ffi/tests/unit/test_error_handling.rs (1)
111-127: Add coverage for newly introduced error variants.Consider adding assertions for the new
dash_spv::Errorvariants (e.g.,UninitializedClient,TaskFailed,QuorumLookupError,ChannelFailure,Logging) to lock in the FFI mapping behavior.dash-spv/src/network/manager.rs (1)
905-938: UseError::TaskFailedfor task panics to preserve error context.The broadcast method currently converts
JoinErrortoNetworkError::ConnectionFailed, which loses the error type and context. SinceError::TaskFailed(#[from] JoinError)is already defined, use that instead:Suggested change
- Err(_) => { - results.push(Err(crate::Error::Network(crate::NetworkError::ConnectionFailed( - "Task panicked during broadcast".to_string(), - )))) - } + Err(join_err) => { + results.push(Err(crate::Error::TaskFailed(join_err))) + }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (59)
dash-spv-ffi/src/broadcast.rsdash-spv-ffi/src/client.rsdash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/clippy.tomldash-spv/src/chain/chainlock_manager.rsdash-spv/src/chain/chainlock_test.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/src/client/config_test.rsdash-spv/src/client/core.rsdash-spv/src/client/interface.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/client/message_handler.rsdash-spv/src/client/progress.rsdash-spv/src/client/queries.rsdash-spv/src/client/status_display.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/transactions.rsdash-spv/src/error.rsdash-spv/src/lib.rsdash-spv/src/logging.rsdash-spv/src/main.rsdash-spv/src/network/discovery.rsdash-spv/src/network/handshake.rsdash-spv/src/network/manager.rsdash-spv/src/network/mock.rsdash-spv/src/network/mod.rsdash-spv/src/network/peer.rsdash-spv/src/network/persist.rsdash-spv/src/network/pool.rsdash-spv/src/storage/blocks.rsdash-spv/src/storage/chainstate.rsdash-spv/src/storage/io.rsdash-spv/src/storage/lockfile.rsdash-spv/src/storage/masternode.rsdash-spv/src/storage/mod.rsdash-spv/src/sync/filters/download.rsdash-spv/src/sync/filters/headers.rsdash-spv/src/sync/filters/manager.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/sync/filters/retry.rsdash-spv/src/sync/headers/manager.rsdash-spv/src/sync/headers/validation.rsdash-spv/src/sync/manager.rsdash-spv/src/sync/masternodes/manager.rsdash-spv/src/sync/message_handlers.rsdash-spv/src/sync/phase_execution.rsdash-spv/src/sync/post_sync.rsdash-spv/src/sync/transitions.rsdash-spv/src/validation/instantlock.rsdash-spv/tests/block_download_test.rsdash-spv/tests/chainlock_simple_test.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/error_types_test.rsdash-spv/tests/filter_header_verification_test.rsdash-spv/tests/storage_test.rs
💤 Files with no reviewable changes (1)
- dash-spv/tests/error_types_test.rs
✅ Files skipped from review due to trivial changes (1)
- dash-spv/src/network/peer.rs
🚧 Files skipped from review as they are similar to previous changes (21)
- dash-spv/tests/chainlock_simple_test.rs
- dash-spv/src/logging.rs
- dash-spv/src/storage/io.rs
- dash-spv/src/storage/lockfile.rs
- dash-spv/src/sync/filters/headers.rs
- dash-spv/src/sync/filters/manager.rs
- dash-spv-ffi/src/broadcast.rs
- dash-spv/src/sync/masternodes/manager.rs
- dash-spv/src/sync/headers/validation.rs
- dash-spv/src/sync/phase_execution.rs
- dash-spv/src/main.rs
- dash-spv/src/client/transactions.rs
- dash-spv/src/sync/headers/manager.rs
- dash-spv/src/sync/message_handlers.rs
- dash-spv/src/sync/post_sync.rs
- dash-spv/src/client/config_test.rs
- dash-spv/src/network/pool.rs
- dash-spv/src/client/status_display.rs
- dash-spv/src/sync/filters/retry.rs
- dash-spv/src/storage/mod.rs
- dash-spv/src/network/mock.rs
🧰 Additional context used
📓 Path-based instructions (10)
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.rs: Never hardcode network parameters, addresses, or keys
Use proper error types (thiserror) and propagate errors appropriately
Use tokio runtime for async operations
Use conditional compilation for optional features
Use proptest for property-based testing where appropriate
Always validate inputs from untrusted sources
Never log or expose private keys
Format code using cargo fmt
Ensure clippy passes with all features enabled and -D warnings flag
**/*.rs: Keep unit tests in the source code alongside implementation using#[cfg(test)]modules
Usesnake_casefor function and variable names
UseUpperCamelCasefor types and traits
UseSCREAMING_SNAKE_CASEfor constants
Format code withrustfmtfollowing therustfmt.tomlconfiguration; runcargo fmt --allbefore commits
Avoidunwrap()andexpect()in library code; use explicit error types (e.g.,thiserror)
Usetokiofor async/await implementations
Run clippy with warnings-as-errors for linting:cargo clippy --workspace --all-targets -- -D warnings
Maintain Minimum Supported Rust Version (MSRV) of 1.89
Follow crate-specific idioms for mixed Rust editions (2021/2024)
Files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/src/storage/chainstate.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/storage/masternode.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
dash-spv/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
dash-spv/**/*.rs: Use trait-based abstractions for swappable implementations (e.g.,NetworkManager,StorageManager)
Use async/await throughout the codebase instead of callback-based patterns
Use domain-specific error types (NetworkError,StorageError,SyncError,ValidationError,SpvError) for error handling
Use Tokio channels for inter-component message passing in async architecture
Runcargo fmt --checkto verify code formatting before committing
Runcargo clippy --all-targets --all-features -- -D warningsto catch potential bugs and style issues
Write unit tests in-module and integration tests in thetests/directory following the test organization strategy
UseArc<dyn TraitName>for trait objects in Rust to support runtime polymorphism
Files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/src/storage/chainstate.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/lib.rsdash-spv/src/client/queries.rsdash-spv/src/storage/masternode.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
dash-spv/src/network/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
dash-spv/src/network/**/*.rs: Use DNS-first peer discovery with automatic fallback to DNS seeds when no explicit peers are configured
Implement configurable timeouts with recovery mechanisms in network operations
Files:
dash-spv/src/network/mod.rsdash-spv/src/network/discovery.rsdash-spv/src/network/handshake.rsdash-spv/src/network/persist.rsdash-spv/src/network/manager.rs
dash-spv/src/sync/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
dash-spv/src/sync/**/*.rs: Use sequential phase-based synchronization viaSyncManagerfor organized sync coordination
Implement state machines usingSyncStateenum to drive synchronization flow
Files:
dash-spv/src/sync/filters/requests.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/sync/transitions.rsdash-spv/src/sync/manager.rsdash-spv/src/sync/filters/download.rs
**/*test*.rs
📄 CodeRabbit inference engine (AGENTS.md)
Write descriptive test names (e.g.,
test_parse_address_mainnet)
Files:
dash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/tests/block_download_test.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
dash-spv/src/storage/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Implement
StorageManagertrait for storage backends and store headers in 10,000-header segments with index files
Files:
dash-spv/src/storage/chainstate.rsdash-spv/src/storage/blocks.rsdash-spv/src/storage/masternode.rs
dash-spv/src/validation/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Implement configurable validation modes (
ValidationMode::None,ValidationMode::Basic,ValidationMode::Full)
Files:
dash-spv/src/validation/instantlock.rs
dash-spv-ffi/src/**/*.rs
📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md)
dash-spv-ffi/src/**/*.rs: Use#[no_mangle] extern "C"attribute when implementing new FFI functions in Rust
All FFI types must have corresponding_destroy()functions for explicit memory management
Rust strings must be returned as*const c_charwith caller responsibility to free usingdash_string_free
Input strings in FFI functions are*const c_char(borrowed, not freed by C caller)
Add cbindgen annotations for complex types in FFI functions
Use thread-local storage for error propagation viadash_spv_ffi_get_last_error()function
Files:
dash-spv-ffi/src/client.rsdash-spv-ffi/src/error.rs
**/*-ffi/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*-ffi/**/*.rs: Exercise careful memory safety handling at FFI boundaries
Be careful with FFI memory management
Files:
dash-spv-ffi/src/client.rsdash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rs
dash-spv-ffi/tests/unit/**/*.rs
📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md)
Add corresponding unit tests in
tests/unit/for each new FFI function
Files:
dash-spv-ffi/tests/unit/test_error_handling.rs
🧠 Learnings (43)
📓 Common learnings
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Use thread-local storage for error propagation via `dash_spv_ffi_get_last_error()` function
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Run `cargo fmt --check` to verify code formatting before committing
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Run `cargo clippy --all-targets --all-features -- -D warnings` to catch potential bugs and style issues
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use domain-specific error types (`NetworkError`, `StorageError`, `SyncError`, `ValidationError`, `SpvError`) for error handling
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Rust strings must be returned as `*const c_char` with caller responsibility to free using `dash_string_free`
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase instead of callback-based patterns
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T16:01:37.609Z
Learning: The mempool tracking infrastructure (UnconfirmedTransaction, MempoolState, configuration, and mempool_filter.rs) is fully implemented and integrated in the Dash SPV client as of this PR, including client logic, FFI APIs, and tests.
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Use sequential phase-based synchronization via `SyncManager` for organized sync coordination
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use trait-based abstractions for swappable implementations (e.g., `NetworkManager`, `StorageManager`)
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/src/storage/chainstate.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/lib.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/storage/masternode.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use domain-specific error types (`NetworkError`, `StorageError`, `SyncError`, `ValidationError`, `SpvError`) for error handling
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/src/storage/chainstate.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/storage/masternode.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Run `cargo fmt --check` to verify code formatting before committing
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/clippy.tomldash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/storage/masternode.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/network/**/*.rs : Implement configurable timeouts with recovery mechanisms in network operations
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/network/handshake.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/sync/transitions.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/client/queries.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Run `cargo clippy --all-targets --all-features -- -D warnings` to catch potential bugs and style issues
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/clippy.tomldash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/storage/masternode.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/network/**/*.rs : Use DNS-first peer discovery with automatic fallback to DNS seeds when no explicit peers are configured
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/network/discovery.rsdash-spv/src/network/handshake.rsdash-spv/src/client/lifecycle.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/tests/block_download_test.rsdash-spv/src/client/queries.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase instead of callback-based patterns
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/src/network/handshake.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv-ffi/src/error.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use Tokio channels for inter-component message passing in async architecture
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/sync/filters/requests.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/src/network/handshake.rsdash-spv/clippy.tomldash-spv/src/client/sync_coordinator.rsdash-spv/src/client/lifecycle.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/client/message_handler.rsdash-spv-ffi/src/client.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv-ffi/src/error.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/validation/**/*.rs : Implement configurable validation modes (`ValidationMode::None`, `ValidationMode::Basic`, `ValidationMode::Full`)
Applied to files:
dash-spv/src/network/mod.rsdash-spv/src/network/discovery.rsdash-spv/src/client/core.rsdash-spv/src/client/mempool.rsdash-spv/src/validation/instantlock.rsdash-spv-ffi/src/client.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/src/error.rsdash-spv/src/client/queries.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Use `#[no_mangle] extern "C"` attribute when implementing new FFI functions in Rust
Applied to files:
dash-spv/src/network/mod.rsdash-spv/clippy.tomldash-spv/src/sync/filters/matching.rsdash-spv/src/storage/blocks.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/sync/filters/download.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Use sequential phase-based synchronization via `SyncManager` for organized sync coordination
Applied to files:
dash-spv/src/sync/filters/requests.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/lifecycle.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/client/message_handler.rsdash-spv-ffi/src/client.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/tests/block_download_test.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv/src/client/queries.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Implement state machines using `SyncState` enum to drive synchronization flow
Applied to files:
dash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/client/progress.rsdash-spv/src/chain/chainlock_test.rsdash-spv/src/network/handshake.rsdash-spv/src/storage/chainstate.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv-ffi/src/client.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/error.rsdash-spv/src/sync/manager.rsdash-spv-ffi/src/error.rsdash-spv/src/storage/masternode.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Use thread-local storage for error propagation via `dash_spv_ffi_get_last_error()` function
Applied to files:
dash-spv/src/sync/filters/requests.rsdash-spv/src/network/discovery.rsdash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/src/network/handshake.rsdash-spv/src/storage/chainstate.rsdash-spv/clippy.tomldash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/client/message_handler.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/sync/transitions.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/error.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/client/queries.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/src/storage/masternode.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:24.093Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-16T14:54:24.093Z
Learning: Applies to **/*.rs : Avoid `unwrap()` and `expect()` in library code; use explicit error types (e.g., `thiserror`)
Applied to files:
dash-spv/src/sync/filters/requests.rsdash-spv/clippy.toml
📚 Learning: 2025-09-03T17:45:58.984Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 134
File: dash-spv/src/network/discovery.rs:14-14
Timestamp: 2025-09-03T17:45:58.984Z
Learning: In hickory_resolver 0.25.0+, TokioAsyncResolver is deprecated in favor of TokioResolver. When migrating from trust_dns_resolver to hickory_resolver, the correct type to use is TokioResolver, not TokioAsyncResolver.
Applied to files:
dash-spv/src/network/discovery.rs
📚 Learning: 2025-06-26T16:01:37.609Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T16:01:37.609Z
Learning: The mempool tracking infrastructure (UnconfirmedTransaction, MempoolState, configuration, and mempool_filter.rs) is fully implemented and integrated in the Dash SPV client as of this PR, including client logic, FFI APIs, and tests.
Applied to files:
dash-spv/src/client/progress.rsdash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/client/message_handler.rsdash-spv-ffi/src/client.rsdash-spv/src/network/manager.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2025-06-26T15:54:02.509Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:54:02.509Z
Learning: The `StorageManager` trait in `dash-spv/src/storage/mod.rs` uses `&mut self` methods but is also `Send + Sync`, and implementations often use interior mutability for concurrency. This can be confusing, so explicit documentation should clarify thread-safety expectations and the rationale for the API design.
Applied to files:
dash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/src/storage/chainstate.rsdash-spv/clippy.tomldash-spv/src/client/core.rsdash-spv/src/network/persist.rsdash-spv/src/storage/blocks.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/storage/masternode.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Write unit tests in-module and integration tests in the `tests/` directory following the test organization strategy
Applied to files:
dash-spv/src/chain/chainlock_test.rsdash-spv/tests/storage_test.rsdash-spv/tests/block_download_test.rsdash-spv/src/lib.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2026-01-16T14:54:24.093Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-16T14:54:24.093Z
Learning: Applies to **/*.rs : Use `tokio` for async/await implementations
Applied to files:
dash-spv/src/chain/chainlock_test.rsdash-spv/clippy.toml
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/src/storage/**/*.rs : Implement `StorageManager` trait for storage backends and store headers in 10,000-header segments with index files
Applied to files:
dash-spv/tests/storage_test.rsdash-spv/src/storage/chainstate.rsdash-spv/src/client/sync_coordinator.rsdash-spv/src/client/core.rsdash-spv/src/client/lifecycle.rsdash-spv/src/network/persist.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/lib.rsdash-spv/src/storage/masternode.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/src/sync/filters/download.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/tests/unit/**/*.rs : Add corresponding unit tests in `tests/unit/` for each new FFI function
Applied to files:
dash-spv/tests/storage_test.rsdash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rsdash-spv/tests/edge_case_filter_sync_test.rsdash-spv/tests/filter_header_verification_test.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Rust strings must be returned as `*const c_char` with caller responsibility to free using `dash_string_free`
Applied to files:
dash-spv/tests/storage_test.rsdash-spv/src/client/core.rsdash-spv-ffi/src/client.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/interface.rsdash-spv/src/client/config.rsdash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Add cbindgen annotations for complex types in FFI functions
Applied to files:
dash-spv/clippy.tomldash-spv/src/sync/filters/matching.rsdash-spv/src/validation/instantlock.rsdash-spv/src/lib.rsdash-spv-ffi/src/error.rsdash-spv/src/sync/filters/download.rs
📚 Learning: 2026-01-16T14:53:56.692Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T14:53:56.692Z
Learning: Applies to **/*.rs : Ensure clippy passes with all features enabled and -D warnings flag
Applied to files:
dash-spv/clippy.toml
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/Cargo.toml : Maintain Minimum Rust Version (MSRV) of 1.89 and ensure all dependencies compile with `cargo check --all-features`
Applied to files:
dash-spv/clippy.tomldash-spv/src/client/mempool.rsdash-spv/src/validation/instantlock.rsdash-spv/src/storage/blocks.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/config.rsdash-spv/src/lib.rsdash-spv/src/sync/filters/download.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : All FFI types must have corresponding `_destroy()` functions for explicit memory management
Applied to files:
dash-spv/clippy.tomldash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rs
📚 Learning: 2026-01-16T14:53:56.692Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T14:53:56.692Z
Learning: Applies to **/*-ffi/**/*.rs : Exercise careful memory safety handling at FFI boundaries
Applied to files:
dash-spv/clippy.toml
📚 Learning: 2026-01-16T14:53:56.692Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T14:53:56.692Z
Learning: Applies to **/*.rs : Use tokio runtime for async operations
Applied to files:
dash-spv/clippy.toml
📚 Learning: 2026-01-16T14:53:56.692Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T14:53:56.692Z
Learning: Applies to **/*-ffi/**/*.rs : Be careful with FFI memory management
Applied to files:
dash-spv/clippy.toml
📚 Learning: 2025-11-27T10:30:54.015Z
Learnt from: xdustinface
Repo: dashpay/rust-dashcore PR: 214
File: dash-spv/examples/filter_sync.rs:48-51
Timestamp: 2025-11-27T10:30:54.015Z
Learning: The DashSpvClient::run method in dash-spv internally handles Ctrl-C shutdown by spawning a task that listens for tokio::signal::ctrl_c() and cancels the provided CancellationToken. Examples and callers should create a CancellationToken without explicitly cancelling it, as the cancellation is managed internally by the run method.
Applied to files:
dash-spv/src/client/sync_coordinator.rsdash-spv-ffi/src/client.rsdash-spv/src/error.rs
📚 Learning: 2026-01-16T14:53:56.692Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-16T14:53:56.692Z
Learning: Applies to **/*.rs : Use proper error types (thiserror) and propagate errors appropriately
Applied to files:
dash-spv/src/client/sync_coordinator.rsdash-spv/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rs
📚 Learning: 2025-06-26T16:02:42.390Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T16:02:42.390Z
Learning: Passing exclusive mutable references to network and storage managers into the sync manager in async Rust can lead to borrow checker issues or runtime contention if concurrent access is needed elsewhere. It's advisable to document this architectural tradeoff and consider refactoring to interior mutability or message passing for shared access as the codebase evolves.
Applied to files:
dash-spv/src/client/lifecycle.rsdash-spv/src/client/mempool.rsdash-spv/src/sync/filters/matching.rsdash-spv/src/client/message_handler.rsdash-spv/src/chain/chainlock_manager.rsdash-spv/src/client/chainlock.rsdash-spv/src/client/queries.rsdash-spv/src/network/manager.rsdash-spv/src/sync/filters/download.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Input strings in FFI functions are `*const c_char` (borrowed, not freed by C caller)
Applied to files:
dash-spv-ffi/src/client.rsdash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rs
📚 Learning: 2025-02-25T06:13:52.858Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 51
File: dash/src/sml/masternode_list/scores_for_quorum.rs:50-73
Timestamp: 2025-02-25T06:13:52.858Z
Learning: ScoreHash is a cryptographic hash in the rust-dashcore library, and therefore does not need collision handling when used as a key in collections like BTreeMap due to the extremely low probability of collisions.
Applied to files:
dash-spv/src/storage/blocks.rs
📚 Learning: 2025-02-25T06:19:32.230Z
Learnt from: QuantumExplorer
Repo: dashpay/rust-dashcore PR: 51
File: dash/src/sml/masternode_list_entry/hash.rs:7-12
Timestamp: 2025-02-25T06:19:32.230Z
Learning: The `consensus_encode` method on `MasternodeListEntry` writing to a `Vec` buffer cannot fail, so using `.expect()` is appropriate rather than propagating the error with the `?` operator.
Applied to files:
dash-spv/src/chain/chainlock_manager.rsdash-spv/src/error.rsdash-spv/src/client/queries.rsdash-spv/src/storage/masternode.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Applies to dash-spv/**/*.rs : Use `Arc<dyn TraitName>` for trait objects in Rust to support runtime polymorphism
Applied to files:
dash-spv/src/client/chainlock.rsdash-spv-ffi/src/error.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Use the `?` operator for error propagation, provide context in error messages, never panic in library code, and return `Result<T>` for all fallible operations
Applied to files:
dash-spv/src/error.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/account/**/*.rs : Use enum-based type system for `AccountType` with specific variants (Standard, IdentityAuthentication, IdentityEncryption, MasternodeOperator, etc.) to provide compile-time safety and clear semantics
Applied to files:
dash-spv/src/error.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Separate immutable structures (`Account`, `Wallet`) containing only identity information from mutable wrappers (`ManagedAccount`, `ManagedWalletInfo`) with state management
Applied to files:
dash-spv/src/error.rs
📚 Learning: 2025-12-19T00:07:22.904Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-12-19T00:07:22.904Z
Learning: Applies to key-wallet/**/*.rs : Always validate network consistency when deriving or validating addresses; never mix mainnet and testnet operations
Applied to files:
dash-spv/src/error.rsdash-spv/src/client/queries.rs
📚 Learning: 2026-01-16T14:54:10.809Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2026-01-16T14:54:10.809Z
Learning: Follow a layered, trait-based architecture with clear separation of concerns across modules: client, network, storage, sync, validation, wallet, types, and error
Applied to files:
dash-spv/src/lib.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: When debugging FFI issues, check `dash_spv_ffi_get_last_error()` for error details
Applied to files:
dash-spv-ffi/src/error.rsdash-spv-ffi/tests/unit/test_error_handling.rs
🧬 Code graph analysis (16)
dash-spv/src/client/progress.rs (2)
dash-spv/src/client/status_display.rs (2)
sync_progress(100-134)stats(137-140)dash-spv/src/network/peer.rs (1)
stats(703-705)
dash-spv/src/chain/chainlock_test.rs (1)
dash-spv/src/chain/chainlock_manager.rs (2)
has_chain_lock_at_height(311-313)would_violate_chain_lock(346-366)
dash-spv/src/storage/chainstate.rs (1)
dash-spv/src/main.rs (1)
e(21-21)
dash-spv/src/client/sync_coordinator.rs (1)
dash-spv/src/client/core.rs (1)
storage(161-163)
dash-spv/src/client/lifecycle.rs (1)
dash-spv/src/client/core.rs (1)
storage(161-163)
dash-spv/src/client/mempool.rs (2)
dash-spv-ffi/src/client.rs (1)
txid(273-273)dash-spv-ffi/src/broadcast.rs (1)
dashcore(36-36)
dash-spv/src/network/persist.rs (2)
dash-spv/src/storage/io.rs (1)
atomic_write(24-57)dash-spv/src/storage/mod.rs (2)
clear(70-70)clear(203-244)
dash-spv/src/client/chainlock.rs (2)
dash-spv/src/sync/masternodes/manager.rs (1)
engine(583-585)dash-spv/src/chain/chainlock_manager.rs (1)
new(54-63)
dash-spv/src/client/config.rs (1)
dash-spv-ffi/src/error.rs (1)
from(52-65)
dash-spv/src/error.rs (1)
dash-spv-ffi/src/error.rs (1)
from(52-65)
dash-spv-ffi/src/error.rs (3)
dash-spv/src/types.rs (2)
from(69-74)from(78-83)dash-spv-ffi/src/config.rs (1)
from(16-22)dash-spv-ffi/src/types.rs (9)
from(57-67)from(86-111)from(128-179)from(191-200)from(220-235)from(250-268)from(397-402)from(406-411)from(425-437)
dash-spv/src/client/queries.rs (2)
dash-spv/src/network/manager.rs (1)
disconnect_peer(946-957)dash-spv/src/client/transactions.rs (1)
network(13-16)
dash-spv-ffi/tests/unit/test_error_handling.rs (1)
dash-spv-ffi/src/error.rs (1)
from(52-65)
dash-spv/src/network/manager.rs (1)
dash-spv/src/network/mod.rs (6)
connect(36-36)disconnect(39-39)send_message(42-42)receive_message(45-45)get_peer_best_height(57-57)update_peer_dsq_preference(83-83)
dash-spv/tests/edge_case_filter_sync_test.rs (5)
dash-spv/src/network/mock.rs (1)
get_peer_best_height(169-171)dash-spv/src/network/mod.rs (1)
get_peer_best_height(57-57)dash-spv/src/network/manager.rs (1)
get_peer_best_height(1265-1312)dash-spv/tests/block_download_test.rs (1)
get_peer_best_height(91-93)dash-spv/tests/filter_header_verification_test.rs (1)
get_peer_best_height(86-88)
dash-spv/tests/filter_header_verification_test.rs (5)
dash-spv/src/network/mock.rs (1)
get_peer_best_height(169-171)dash-spv/src/network/mod.rs (1)
get_peer_best_height(57-57)dash-spv/src/network/manager.rs (1)
get_peer_best_height(1265-1312)dash-spv/tests/block_download_test.rs (1)
get_peer_best_height(91-93)dash-spv/tests/edge_case_filter_sync_test.rs (1)
get_peer_best_height(90-92)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: macOS / spv
- GitHub Check: Windows / spv
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
…nstead of a String
1b21f7d to
6497a2a
Compare
Summary by CodeRabbit
Release Notes
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.