Skip to content

Conversation

@ZocoLini
Copy link
Collaborator

@ZocoLini ZocoLini commented Jan 16, 2026

  • Removed unused error types
  • Removed tracing where errors where being propagated allowing us to use the ? operator
  • Usage of the ? operator when possible
  • SpvError renamed to Error following Rust standard
  • dash_spv::Result and dash_spv::Error should always be used qualifying the full path to avoid ambiguity
  • dash_spv::Result used whenever is possible
  • Poisoned lock error removed by enforcing all RwLock and Mutex to be tokio variants powered by clippy deny disallowed_types
  • Tests for conversion beetwen errors dropped. We are already testing that behavior by using them
  • New error types introduced where needed

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved error handling consistency across the library with clearer error messages.
    • Fixed uninitialized client error reporting.
  • Refactor

    • Migrated internal locking mechanisms to async-safe primitives for better concurrent performance.
    • Consolidated and simplified error type hierarchy for improved reliability.
    • Enhanced async/await integration throughout the codebase.

✏️ Tip: You can customize this high-level summary in your review settings.

@ZocoLini ZocoLini marked this pull request as draft January 16, 2026 02:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 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.

📝 Walkthrough

Walkthrough

This pull request consolidates error handling by renaming SpvError to Error, adds new error variants (UninitializedClient, Config, QuorumLookupError, TaskFailed), converts chainlock manager methods to async operations with tokio::sync primitives, reorganizes error imports to use crate-level re-exports, and updates the FFI and client layers to use the new unified error type throughout.

Changes

Cohort / File(s) Summary
Error Type Consolidation & Central Enum Refactoring
dash-spv/src/error.rs, dash-spv/src/lib.rs, dash-spv/src/main.rs
Renamed public SpvError enum to Error; added variants UninitializedClient, Config(String), QuorumLookupError(String), TaskFailed; removed variants Io, General, Parse, WalletError, and others; updated Result<T> alias to std::result::Result<T, Error>; adjusted public re-exports in lib.rs to expose Error, Result, and result type aliases at crate root.
Chainlock Manager Async Conversion
dash-spv/src/chain/chainlock_manager.rs, dash-spv/src/chain/chainlock_test.rs
Replaced std::sync::RwLock with tokio::sync::RwLock; converted all public methods to async (e.g., has_chain_lock_at_height, get_chain_lock_by_height, queue_pending_chainlock, validate_pending_chainlocks, process_chain_lock); updated lock acquisitions to use .await; updated test invocations to await all async method calls.
Client Chainlock Error Type Updates
dash-spv/src/client/chainlock.rs, dash-spv/src/client/config.rs
Changed return types to crate::Result<()> and crate::Result<bool>; replaced SpvError::Validation with crate::Error::Validation; updated update_chainlock_validation to async; adjusted config validation error returns to use crate::Error::Config.
Client Lifecycle & Core Methods Error Updates
dash-spv/src/client/lifecycle.rs, dash-spv/src/client/core.rs
Updated method signatures to return crate::Result<T> for new, start, stop, shutdown, start_sync, initialize_genesis_block, load_wallet_data, clear_storage, update_config; replaced all SpvError mappings with crate::Error equivalents; removed explicit error wrapping in favor of ? operator.
Client Mempool, Progress & Query Methods
dash-spv/src/client/mempool.rs, dash-spv/src/client/progress.rs, dash-spv/src/client/queries.rs, dash-spv/src/client/status_display.rs
Changed return types from local Result<T> to crate::Result<T>; removed crate::error::Result imports; updated error construction to use crate::Error variants; extended get_mempool_balance with per-address pending balance computation.
Client Message Handling & Sync Coordination
dash-spv/src/client/message_handler.rs, dash-spv/src/client/sync_coordinator.rs, dash-spv/src/client/transactions.rs, dash-spv/src/client/interface.rs
Updated public method return types to crate::Result<T>; replaced error mappings from SpvError to crate::Error variants; simplified error handling using ? operator; removed old Result<T> type alias; adjusted awaited calls for chainlock validation.
Network Layer Error Path Consolidation
dash-spv/src/network/manager.rs, dash-spv/src/network/persist.rs, dash-spv/src/network/pool.rs, dash-spv/src/network/discovery.rs, dash-spv/src/network/handshake.rs, dash-spv/src/network/mock.rs, dash-spv/src/network/peer.rs, dash-spv/src/network/mod.rs
Updated import paths from crate::error::{NetworkError, NetworkResult} to crate::{NetworkError, NetworkResult}; changed public method signatures to explicitly qualify error returns with crate::NetworkError and crate::NetworkResult; removed local error aliases.
Storage Layer Error Path Updates
dash-spv/src/storage/blocks.rs, dash-spv/src/storage/chainstate.rs, dash-spv/src/storage/io.rs, dash-spv/src/storage/lockfile.rs, dash-spv/src/storage/masternode.rs, dash-spv/src/storage/mod.rs
Updated import paths from crate::error::{StorageError, StorageResult} to crate::{StorageError, StorageResult}; added public exports for storage trait interfaces; updated error mapping calls to use crate-qualified paths.
Sync Module Error Path Updates
dash-spv/src/sync/filters/download.rs, dash-spv/src/sync/filters/headers.rs, dash-spv/src/sync/filters/manager.rs, dash-spv/src/sync/filters/matching.rs, dash-spv/src/sync/filters/requests.rs, dash-spv/src/sync/filters/retry.rs, dash-spv/src/sync/headers/manager.rs, dash-spv/src/sync/headers/validation.rs, dash-spv/src/sync/manager.rs, dash-spv/src/sync/masternodes/manager.rs, dash-spv/src/sync/message_handlers.rs, dash-spv/src/sync/phase_execution.rs, dash-spv/src/sync/post_sync.rs, dash-spv/src/sync/transitions.rs
Consolidated import paths from crate::error::{SyncError, SyncResult, ValidationError, ValidationResult} to crate::{...} equivalents; updated test imports to match new re-export paths.
FFI Layer Error Type Updates
dash-spv-ffi/src/broadcast.rs, dash-spv-ffi/src/client.rs, dash-spv-ffi/src/error.rs
Replaced SpvError with dash_spv::Error in error conversions; updated stop_client_internal signature to return dash_spv::Result<()>; changed all internal guard failure paths to map to dash_spv::Error::UninitializedClient; updated impl From<dash_spv::Error> for FFIErrorCode match arms.
Clippy Configuration
dash-spv/clippy.toml
Added disallowed-types configuration blocking std::sync::RwLock and std::sync::Mutex with suggestions to use tokio equivalents.
Tests Updated & Removed
dash-spv-ffi/tests/unit/test_error_handling.rs, dash-spv/tests/block_download_test.rs, dash-spv/tests/chainlock_simple_test.rs, dash-spv/tests/edge_case_filter_sync_test.rs, dash-spv/tests/error_types_test.rs, dash-spv/tests/filter_header_verification_test.rs, dash-spv/tests/storage_test.rs, dash-spv/src/client/config_test.rs
Updated test imports and method calls to use new error types and async signatures; converted error assertions to use stringified comparisons; removed comprehensive error_types_test.rs; updated NetworkManager mock implementations to use crate-level error re-exports.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • xdustinface

Poem

🐰 Errors now have a single name,
Async locks bring tokio fame,
Chainlock methods dance with await,
No more SpvError—just Error's great!
Refactored paths flow crate-wise home. 🌿

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Chore: error cleanup' accurately describes the main objective of this pull request, which comprehensively refactors error handling across the codebase by consolidating error types and reorganizing error module exports.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 from update_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 the masternode_engine read guard is held. The comment "engine_guard dropped before any await" is incorrect—the guard persists across both await calls until line 217. Clone the Option<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_chainlocks acquires a write lock and holds it while calling self.process_chain_lock(...).await in a loop. If process_chain_lock encounters missing masternode list data, it calls self.queue_pending_chainlock(...), which attempts to re-acquire the same lock from the same task. Tokio's RwLock is 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.

@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Jan 16, 2026
@github-actions
Copy link

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@ZocoLini ZocoLini force-pushed the chore/error-cleanup branch from b6f854e to 1b21f7d Compare January 16, 2026 16:05
@github-actions github-actions bot removed the merge-conflict The PR conflicts with the target branch. label Jan 16, 2026
@ZocoLini ZocoLini marked this pull request as ready for review January 16, 2026 16:13
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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_chainlocks is acquired at line 95 and held throughout the iteration. However, process_chain_lock (called at line 103) can invoke queue_pending_chainlock (at lines 201, 215), which attempts to acquire a write lock on the same pending_chainlocks. With tokio::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::SyncResult is 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-exported StorageResult type alias for consistency.

Line 6 imports StorageResult from crate::error, but StorageResult is re-exported at the crate root in lib.rs (line 81). Other storage files (storage/mod.rs, storage/blocks.rs) import it directly as crate::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::Error variants (e.g., UninitializedClient, TaskFailed, QuorumLookupError, ChannelFailure, Logging) to lock in the FFI mapping behavior.

dash-spv/src/network/manager.rs (1)

905-938: Use Error::TaskFailed for task panics to preserve error context.

The broadcast method currently converts JoinError to NetworkError::ConnectionFailed, which loses the error type and context. Since Error::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

📥 Commits

Reviewing files that changed from the base of the PR and between b6f854e and 1b21f7d.

📒 Files selected for processing (59)
  • dash-spv-ffi/src/broadcast.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/clippy.toml
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/src/client/config_test.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/client/status_display.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/transactions.rs
  • dash-spv/src/error.rs
  • dash-spv/src/lib.rs
  • dash-spv/src/logging.rs
  • dash-spv/src/main.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/src/network/mock.rs
  • dash-spv/src/network/mod.rs
  • dash-spv/src/network/peer.rs
  • dash-spv/src/network/persist.rs
  • dash-spv/src/network/pool.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/storage/io.rs
  • dash-spv/src/storage/lockfile.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/storage/mod.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-spv/src/sync/filters/headers.rs
  • dash-spv/src/sync/filters/manager.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/sync/filters/retry.rs
  • dash-spv/src/sync/headers/manager.rs
  • dash-spv/src/sync/headers/validation.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/sync/masternodes/manager.rs
  • dash-spv/src/sync/message_handlers.rs
  • dash-spv/src/sync/phase_execution.rs
  • dash-spv/src/sync/post_sync.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/tests/chainlock_simple_test.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/tests/error_types_test.rs
  • dash-spv/tests/filter_header_verification_test.rs
  • dash-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
Use snake_case for function and variable names
Use UpperCamelCase for types and traits
Use SCREAMING_SNAKE_CASE for constants
Format code with rustfmt following the rustfmt.toml configuration; run cargo fmt --all before commits
Avoid unwrap() and expect() in library code; use explicit error types (e.g., thiserror)
Use tokio for 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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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
Run cargo fmt --check to verify code formatting before committing
Run cargo clippy --all-targets --all-features -- -D warnings to catch potential bugs and style issues
Write unit tests in-module and integration tests in the tests/ directory following the test organization strategy
Use Arc<dyn TraitName> for trait objects in Rust to support runtime polymorphism

Files:

  • dash-spv/src/network/mod.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/lib.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/network/persist.rs
  • dash-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 via SyncManager for organized sync coordination
Implement state machines using SyncState enum to drive synchronization flow

Files:

  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/sync/manager.rs
  • dash-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.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/tests/filter_header_verification_test.rs
dash-spv/src/storage/**/*.rs

📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)

Implement StorageManager trait for storage backends and store headers in 10,000-header segments with index files

Files:

  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/storage/blocks.rs
  • dash-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_char with caller responsibility to free using dash_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 via dash_spv_ffi_get_last_error() function

Files:

  • dash-spv-ffi/src/client.rs
  • dash-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.rs
  • dash-spv-ffi/src/error.rs
  • dash-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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/lib.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/clippy.toml
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/clippy.toml
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/sync/filters/requests.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/clippy.toml
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/network/manager.rs
  • dash-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.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/src/error.rs
  • dash-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.rs
  • dash-spv/clippy.toml
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-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.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/client/progress.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/error.rs
  • dash-spv/src/sync/manager.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv/src/network/discovery.rs
  • dash-spv/src/chain/chainlock_test.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/network/handshake.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/clippy.toml
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/sync/transitions.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/error.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-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.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-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.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/clippy.toml
  • dash-spv/src/client/core.rs
  • dash-spv/src/network/persist.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-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.rs
  • dash-spv/tests/storage_test.rs
  • dash-spv/tests/block_download_test.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-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.rs
  • 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/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.rs
  • dash-spv/src/storage/chainstate.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/network/persist.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/lib.rs
  • dash-spv/src/storage/masternode.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-spv/src/sync/filters/download.rs
  • dash-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.rs
  • dash-spv-ffi/src/error.rs
  • dash-spv-ffi/tests/unit/test_error_handling.rs
  • dash-spv/tests/edge_case_filter_sync_test.rs
  • dash-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.rs
  • dash-spv/src/client/core.rs
  • dash-spv-ffi/src/client.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/interface.rs
  • dash-spv/src/client/config.rs
  • dash-spv-ffi/src/error.rs
  • dash-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.toml
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/lib.rs
  • dash-spv-ffi/src/error.rs
  • dash-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.toml
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/validation/instantlock.rs
  • dash-spv/src/storage/blocks.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/config.rs
  • dash-spv/src/lib.rs
  • dash-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.toml
  • dash-spv-ffi/src/error.rs
  • dash-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.rs
  • dash-spv-ffi/src/client.rs
  • dash-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.rs
  • dash-spv/src/error.rs
  • dash-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.rs
  • dash-spv/src/client/mempool.rs
  • dash-spv/src/sync/filters/matching.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/chain/chainlock_manager.rs
  • dash-spv/src/client/chainlock.rs
  • dash-spv/src/client/queries.rs
  • dash-spv/src/network/manager.rs
  • dash-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.rs
  • dash-spv-ffi/src/error.rs
  • dash-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.rs
  • dash-spv/src/error.rs
  • dash-spv/src/client/queries.rs
  • dash-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.rs
  • dash-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.rs
  • dash-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.rs
  • dash-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.

@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Jan 16, 2026
@github-actions
Copy link

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@ZocoLini ZocoLini marked this pull request as draft January 17, 2026 19:34
@ZocoLini ZocoLini force-pushed the chore/error-cleanup branch from 1b21f7d to 6497a2a Compare January 19, 2026 01:00
@github-actions github-actions bot removed the merge-conflict The PR conflicts with the target branch. label Jan 19, 2026
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.

2 participants