- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3
 
feat: small fixes #155
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
feat: small fixes #155
Conversation
          
WalkthroughThe PR introduces a typed  Changes
 Sequence Diagram(s)sequenceDiagram
  autonumber
  actor App
  participant SPVFFI as dash-spv-ffi
  participant KWF as key-wallet-ffi
  App->>SPVFFI: dash_spv_ffi_client_get_wallet_manager(client)
  note right of SPVFFI #E8F5E9: returns typed FFIWalletManager* (cloned Arc)
  App->>KWF: wallet_manager_describe(manager*, network, &err)
  KWF-->>App: *char (C string) or null + error
  App->>KWF: wallet_manager_free_string(cstr)
  App->>SPVFFI: dash_spv_ffi_wallet_manager_free(manager*)
    sequenceDiagram
  autonumber
  actor App
  participant Client as DashSpvClient
  participant Storage
  participant Sync as FilterSyncManager
  App->>Client: clear_filters()
  Client->>Storage: clear_filters()
  Storage-->>Client: Ok
  Client->>Sync: clear_filter_state()
  Sync-->>Client: done
  Client-->>App: Ok(())
  note over Client,Storage #F3F4F6: in-memory and persisted filter state cleared
    sequenceDiagram
  autonumber
  participant BP as BlockProcessor
  participant Wallet
  BP->>Wallet: try match compact filter
  alt match
    BP-->>BP: normal processing
  else no match
    BP->>Wallet: await describe(network)
    Wallet-->>BP: description string
    BP-->>BP: debug log includes block hash + description
  end
  note over BP #FFF7E6: wallet lock released after branches
    Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
 Poem
 Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
 ✅ Passed checks (2 passed)
 ✨ Finishing touches
 🧪 Generate unit tests
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
 🚧 Files skipped from review as they are similar to previous changes (1)
 🧰 Additional context used📓 Path-based instructions (10)dash-spv-ffi/src/**/*.rs📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md) 
 Files: 
 **/*.rs📄 CodeRabbit inference engine (CLAUDE.md) 
 Files: 
 {dash-network-ffi,dash-spv-ffi,key-wallet-ffi,swift-dash-core-sdk}/**/*.{rs,c,h,swift}📄 CodeRabbit inference engine (CLAUDE.md) 
 Files: 
 **/src/**/*.rs📄 CodeRabbit inference engine (AGENTS.md) 
 Files: 
 *-ffi/**📄 CodeRabbit inference engine (AGENTS.md) 
 Files: 
 dash-spv-ffi/include/dash_spv_ffi.h📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md) 
 Files: 
 swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h📄 CodeRabbit inference engine (swift-dash-core-sdk/CLAUDE.md) 
 Files: 
 swift-dash-core-sdk/**📄 CodeRabbit inference engine (AGENTS.md) 
 Files: 
 dash-spv/**/*.rs📄 CodeRabbit inference engine (dash-spv/CLAUDE.md) 
 Files: 
 **/tests/**/*.rs📄 CodeRabbit inference engine (CLAUDE.md) 
 Files: 
 🧠 Learnings (17)📓 Common learnings📚 Learning: 2025-08-16T04:14:07.718ZApplied to files: 
 📚 Learning: 2025-08-16T04:14:07.718ZApplied to files: 
 📚 Learning: 2025-08-29T04:01:18.111ZApplied to files: 
 📚 Learning: 2025-08-16T04:14:07.718ZApplied to files: 
 📚 Learning: 2025-08-29T04:00:14.154ZApplied to files: 
 📚 Learning: 2025-08-21T05:01:58.949ZApplied to files: 
 📚 Learning: 2025-08-16T04:14:07.718ZApplied to files: 
 📚 Learning: 2025-08-16T04:15:57.225ZApplied to files: 
 📚 Learning: 2025-08-16T04:15:29.335ZApplied to files: 
 📚 Learning: 2025-06-26T16:01:37.609ZApplied to files: 
 📚 Learning: 2025-08-29T04:00:14.154ZApplied to files: 
 📚 Learning: 2025-08-29T04:01:18.111ZApplied to files: 
 📚 Learning: 2025-08-29T04:01:18.111ZApplied to files: 
 📚 Learning: 2025-08-29T04:01:18.111ZApplied to files: 
 📚 Learning: 2025-08-29T04:01:18.111ZApplied to files: 
 📚 Learning: 2025-08-29T04:01:18.111ZApplied to files: 
 🧬 Code graph analysis (5)dash-spv-ffi/include/dash_spv_ffi.h (1)
 swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h (1)
 dash-spv-ffi/src/client.rs (1)
 dash-spv/src/client/mod.rs (5)
 dash-spv-ffi/tests/test_wallet_manager.rs (3)
 ⏰ 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). (15)
 🔇 Additional comments (21)
 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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note: 
 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: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️  Outside diff range comments (2)
dash-spv/src/client/block_processor.rs (1)
178-200: Avoid holding the write lock across async calls
Refactor block_processor.rs so thatself.wallet.write().awaitis only held forcheck_compact_filter, then dropped before any further.await(e.g.,wallet.describe), using a read lock for logging if needed.dash-spv-ffi/scripts/generate_ffi_docs.py (1)
290-324: Document the matchingdash_spv_ffi_wallet_manager_freecall in the example.The example now advertises a shared-ownership
FFIWalletManager*, but it never shows the mandatorydash_spv_ffi_wallet_manager_free(wallet_manager);call. That contradicts the new bullet point and will leak the handle for anyone following the snippet verbatim. Please add the free call (ideally before destroying the client) so the docs stay self-consistent with the API contract.
🧹 Nitpick comments (9)
key-wallet-manager/src/wallet_manager/process_block.rs (2)
142-165: New describe() API: solid; consider stable ordering and simpler hex formatting.
- For predictable logs across runs, sort details by name or wallet_id before join.
 - Hex encode wallet_id via a helper (e.g., hashes::hex::ToHex) to avoid manual write loop if available under your no_std profile.
 - for (wallet_id, info) in &self.wallet_infos { + let mut entries: Vec<_> = self.wallet_infos.iter().collect(); + entries.sort_by_key(|(id, info)| info.name().unwrap_or("unnamed")); + for (wallet_id, info) in entries { let name = info.name().unwrap_or("unnamed"); - let mut wallet_id_hex = String::with_capacity(wallet_id.len() * 2); - for byte in wallet_id { - let _ = write!(&mut wallet_id_hex, "{:02x}", byte); - } + let mut wallet_id_hex = String::with_capacity(wallet_id.len() * 2); + for byte in wallet_id { let _ = write!(&mut wallet_id_hex, "{:02x}", byte); } let script_count = info.monitored_addresses(network).len(); let summary = format!("{} scripts", script_count); details.push(format!("{} ({}): {}", name, wallet_id_hex, summary)); }
96-116: Avoid silently swallowing filter matching errors.Using unwrap_or(false) suppresses why matching failed. Log at least at debug when an error occurs to aid diagnosis.
- filter - .match_any(block_hash, &mut script_bytes.iter().map(|s| s.as_slice())) - .unwrap_or(false) + match filter.match_any(block_hash, &mut script_bytes.iter().map(|s| s.as_slice())) { + Ok(v) => v, + Err(e) => { tracing::debug!("compact-filter match_any error for {}: {}", block_hash, e); false } + }swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.h (1)
3730-3748: New wallet_manager_describe/free_string look good; ensure callers use the right freer.Swift/FFI callers must pair wallet_manager_describe() with wallet_manager_free_string(). Optionally document that string_free is equivalent to avoid confusion.
dash-spv/src/sync/filters.rs (1)
3470-3476: Scope and verbosity nits for clear_filter_stateConsider reducing API surface and log noise:
- Make method crate-visible; it’s only used internally by the client reset path.
 - Downgrade the log to debug to avoid info-level chatter during resets.
 - pub async fn clear_filter_state(&mut self) { + pub(crate) async fn clear_filter_state(&mut self) { self.reset_pending_requests(); let mut heights = self.received_filter_heights.lock().await; heights.clear(); - tracing::info!("Cleared filter sync state and received heights"); + tracing::debug!("Cleared filter sync state and received heights"); }key-wallet-ffi/include/key_wallet_ffi.h (1)
3730-3748: Avoid duplicating string free APIs; document or alias tostring_freefor consistency.
wallet_manager_free_stringduplicatesstring_freesemantics (both freeCString::from_raw). Prefer reusingstring_freeor explicitly documenting they are equivalent to reduce surface area and prevent misuse across crates. If keeping both, consider making one an alias in C headers to avoid divergence.
Based on learningsdash-spv-ffi/tests/test_wallet_manager.rs (1)
47-123: Good cross-FFI coverage and cleanup orderingSolid end-to-end: native wallet serialize → FFI import → list/describe → free/destroy. Cleanup order is correct and error paths are checked.
Minor robustness ideas (optional):
- Consider asserting description_error is success before deref.
 - If future tests pre-populate wallets, assert inclusion of expected_wallet_id rather than strict count.
 key-wallet-ffi/src/wallet_manager.rs (3)
65-68: Avoid unnecessary Arc clonesYou can borrow the Arcs instead of cloning to avoid atomic inc/dec and reduce noise.
Apply:
- let runtime = manager_ref.runtime.clone(); - let manager_arc = manager_ref.manager.clone(); + let runtime = &manager_ref.runtime; + let manager_arc = &manager_ref.manager;
70-72: Don’t hold an RwLock across an.await
let guard = manager_arc.read().await; guard.describe(...).awaitholds a read guard over an await point, which can starve writers and complicate scheduling. Prefer taking a snapshot outside the lock or refactoringdescribeto avoid borrowing&selfacross await (e.g., adescribe_snapshotthat builds owned data under the lock, then formats without the lock).Confirm
describedoes not perform operations that might indirectly require a write lock while this read lock is held.
92-98: Ergonomics: accept*const c_charin free to avoid caller castsC headers usually expose frees as taking
const char*to spare callers from casting. Internally you can cast back to*mutforfrom_raw.Apply:
-#[no_mangle] -pub unsafe extern "C" fn wallet_manager_free_string(value: *mut c_char) { +#[no_mangle] +pub unsafe extern "C" fn wallet_manager_free_string(value: *const c_char) { if value.is_null() { return; } - drop(CString::from_raw(value)); + drop(CString::from_raw(value as *mut c_char)); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (24)
dash-spv-ffi/FFI_API.md(8 hunks)dash-spv-ffi/dash_spv_ffi.h(1 hunks)dash-spv-ffi/examples/wallet_manager_usage.rs(3 hunks)dash-spv-ffi/include/dash_spv_ffi.h(1 hunks)dash-spv-ffi/scripts/generate_ffi_docs.py(2 hunks)dash-spv-ffi/src/client.rs(2 hunks)dash-spv-ffi/tests/test_wallet_manager.rs(2 hunks)dash-spv/src/client/block_processor.rs(1 hunks)dash-spv/src/client/block_processor_test.rs(2 hunks)dash-spv/src/client/mod.rs(3 hunks)dash-spv/src/storage/disk.rs(1 hunks)dash-spv/src/storage/memory.rs(1 hunks)dash-spv/src/storage/mod.rs(1 hunks)dash-spv/src/sync/filters.rs(1 hunks)dash-spv/tests/error_handling_test.rs(1 hunks)dash-spv/tests/error_recovery_integration_test.rs(1 hunks)key-wallet-ffi/FFI_API.md(5 hunks)key-wallet-ffi/include/key_wallet_ffi.h(1 hunks)key-wallet-ffi/src/lib.rs(1 hunks)key-wallet-ffi/src/wallet_manager.rs(2 hunks)key-wallet-manager/src/wallet_interface.rs(2 hunks)key-wallet-manager/src/wallet_manager/process_block.rs(2 hunks)swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h(1 hunks)swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.h(1 hunks)
🧰 Additional context used
📓 Path-based instructions (13)
dash-spv/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
dash-spv/**/*.rs: Enforce Rust formatting viacargo fmt --checkon all Rust source files
All code must be clippy-clean: runcargo clippy --all-targets --all-features -- -D warnings
Files:
dash-spv/src/storage/mod.rsdash-spv/src/sync/filters.rsdash-spv/tests/error_recovery_integration_test.rsdash-spv/src/client/block_processor.rsdash-spv/src/storage/memory.rsdash-spv/src/storage/disk.rsdash-spv/src/client/mod.rsdash-spv/src/client/block_processor_test.rsdash-spv/tests/error_handling_test.rs
dash-spv/src/storage/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Provide both
MemoryStorageManagerandDiskStorageManagerbehind theStorageManagertrait
Files:
dash-spv/src/storage/mod.rsdash-spv/src/storage/memory.rsdash-spv/src/storage/disk.rs
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.rs: Use proper error types with thiserror and propagate errors appropriately
Use the tokio runtime for async operations in Rust
Use conditional compilation feature flags for optional features (#[cfg(feature = ...)])
Format Rust code with cargo fmt (and enforce via cargo fmt --check)
Run clippy with -D warnings and fix all lints
Adhere to MSRV Rust 1.89 (avoid features requiring newer compiler)
**/*.rs: Format Rust code with rustfmt (per rustfmt.toml); run cargo fmt --all before commits
Lint with clippy; treat warnings as errors in CI
Follow Rust naming: snake_case for functions/variables, UpperCamelCase for types/traits, SCREAMING_SNAKE_CASE for consts
Prefer async using tokio where applicable
Files:
dash-spv/src/storage/mod.rsdash-spv/src/sync/filters.rsdash-spv/tests/error_recovery_integration_test.rsdash-spv/src/client/block_processor.rskey-wallet-ffi/src/lib.rsdash-spv/src/storage/memory.rsdash-spv/src/storage/disk.rskey-wallet-manager/src/wallet_manager/process_block.rsdash-spv/src/client/mod.rskey-wallet-manager/src/wallet_interface.rskey-wallet-ffi/src/wallet_manager.rsdash-spv-ffi/src/client.rsdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rsdash-spv/tests/error_handling_test.rs
**/src/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/src/**/*.rs: Each crate keeps sources in src/
Avoid unwrap()/expect() in library code; use proper error types (e.g., thiserror)
Place unit tests alongside code with #[cfg(test)]
Files:
dash-spv/src/storage/mod.rsdash-spv/src/sync/filters.rsdash-spv/src/client/block_processor.rskey-wallet-ffi/src/lib.rsdash-spv/src/storage/memory.rsdash-spv/src/storage/disk.rskey-wallet-manager/src/wallet_manager/process_block.rsdash-spv/src/client/mod.rskey-wallet-manager/src/wallet_interface.rskey-wallet-ffi/src/wallet_manager.rsdash-spv-ffi/src/client.rsdash-spv/src/client/block_processor_test.rs
{dash-network-ffi,dash-spv-ffi,key-wallet-ffi,swift-dash-core-sdk}/**/*.{rs,c,h,swift}
📄 CodeRabbit inference engine (CLAUDE.md)
Be careful with memory management at FFI boundaries (C/Swift interop)
Files:
swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.hkey-wallet-ffi/include/key_wallet_ffi.hkey-wallet-ffi/src/lib.rskey-wallet-ffi/src/wallet_manager.rsdash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv-ffi/include/dash_spv_ffi.hswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
swift-dash-core-sdk/**
📄 CodeRabbit inference engine (AGENTS.md)
Mobile SDK code resides in swift-dash-core-sdk/
Files:
swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.hswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
dash-spv/tests/**/*.rs
📄 CodeRabbit inference engine (dash-spv/CLAUDE.md)
Place integration tests under the
tests/directory
Files:
dash-spv/tests/error_recovery_integration_test.rsdash-spv/tests/error_handling_test.rs
{dash-spv,rpc-integration-test}/tests/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
Provide integration tests for network operations
Files:
dash-spv/tests/error_recovery_integration_test.rsdash-spv/tests/error_handling_test.rs
**/tests/**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
Use proptest for property-based testing where appropriate
**/tests/**/*.rs: Integration tests must live under tests/ (e.g., rpc-integration-test)
Use descriptive test names (e.g., test_parse_address_mainnet) for integration tests
Mark network-dependent or long-running tests with #[ignore] and run with -- --ignored
Add regression tests for fixes; consider property tests (e.g., proptest) where valuable
Keep test vectors deterministic
Files:
dash-spv/tests/error_recovery_integration_test.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/tests/error_handling_test.rs
*-ffi/**
📄 CodeRabbit inference engine (AGENTS.md)
FFI bindings live in *-ffi crates
Files:
key-wallet-ffi/include/key_wallet_ffi.hdash-spv-ffi/FFI_API.mdkey-wallet-ffi/src/lib.rskey-wallet-ffi/FFI_API.mdkey-wallet-ffi/src/wallet_manager.rsdash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.py
dash-spv-ffi/src/**/*.rs
📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md)
dash-spv-ffi/src/**/*.rs: FFI functions must be declared with #[no_mangle] extern "C"
Expose complex Rust types to C as opaque pointers (e.g., FFIDashSpvClient*)
Provide corresponding _destroy() functions for all FFI-owned types to enforce explicit memory management
Return Rust strings to C as *const c_char; allocate so the caller can free with dash_string_free
Accept input strings from C as *const c_char (borrowed; do not free inputs)
Functions returning pointers transfer ownership to the caller; functions taking pointers only borrow
Add cbindgen annotations for complex types so headers are generated correctly
Files:
dash-spv-ffi/src/client.rs
dash-spv-ffi/include/dash_spv_ffi.h
📄 CodeRabbit inference engine (dash-spv-ffi/CLAUDE.md)
The public C header is generated; ensure it reflects FFI changes after builds
Files:
dash-spv-ffi/include/dash_spv_ffi.h
swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📄 CodeRabbit inference engine (swift-dash-core-sdk/CLAUDE.md)
After updating dash-spv-ffi, synchronize the generated header into the Swift SDK using ./sync-headers.sh so Sources/DashSPVFFI/include/dash_spv_ffi.h stays up to date
Files:
swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
🧠 Learnings (36)
📓 Common learnings
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/src/{managed_account,transaction_checking}/**/*.rs : Update wallet state atomically: add transaction, update UTXOs, recalculate balance, and mark addresses used in a single operation
Learnt from: QuantumExplorer
PR: dashpay/rust-dashcore#108
File: key-wallet-ffi/src/wallet_manager.rs:270-318
Timestamp: 2025-08-21T05:01:58.949Z
Learning: In the key-wallet-ffi design, wallets retrieved from the wallet manager via lookup functions should return const pointers (*const FFIWallet) to enforce read-only access and prevent unintended modifications. The wallet manager should control wallet lifecycle and mutations through specific APIs rather than allowing external mutation of retrieved wallet references.
Learnt from: DCG-Claude
PR: dashpay/rust-dashcore#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.
📚 Learning: 2025-08-25T17:15:59.361Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-08-25T17:15:59.361Z
Learning: Applies to dash-spv/src/storage/**/*.rs : Provide both `MemoryStorageManager` and `DiskStorageManager` behind the `StorageManager` trait
Applied to files:
dash-spv/src/storage/mod.rsdash-spv/tests/error_recovery_integration_test.rsdash-spv/src/storage/memory.rsdash-spv/src/storage/disk.rsdash-spv/src/client/mod.rsdash-spv/tests/error_handling_test.rs
📚 Learning: 2025-06-26T15:54:02.509Z
Learnt from: DCG-Claude
PR: dashpay/rust-dashcore#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/storage/mod.rsdash-spv/tests/error_recovery_integration_test.rsdash-spv/src/storage/memory.rsdash-spv/src/storage/disk.rsdash-spv/src/client/mod.rsdash-spv/tests/error_handling_test.rs
📚 Learning: 2025-08-21T05:01:58.949Z
Learnt from: QuantumExplorer
PR: dashpay/rust-dashcore#108
File: key-wallet-ffi/src/wallet_manager.rs:270-318
Timestamp: 2025-08-21T05:01:58.949Z
Learning: In the key-wallet-ffi design, wallets retrieved from the wallet manager via lookup functions should return const pointers (*const FFIWallet) to enforce read-only access and prevent unintended modifications. The wallet manager should control wallet lifecycle and mutations through specific APIs rather than allowing external mutation of retrieved wallet references.
Applied to files:
swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.hkey-wallet-ffi/include/key_wallet_ffi.hdash-spv-ffi/FFI_API.mdkey-wallet-ffi/src/lib.rskey-wallet-ffi/FFI_API.mdkey-wallet-ffi/src/wallet_manager.rsdash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-29T04:00:14.154Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-29T04:00:14.154Z
Learning: Applies to {dash-network-ffi,dash-spv-ffi,key-wallet-ffi,swift-dash-core-sdk}/**/*.{rs,c,h,swift} : Be careful with memory management at FFI boundaries (C/Swift interop)
Applied to files:
swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.hdash-spv-ffi/FFI_API.mddash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-06-26T16:01:37.609Z
Learnt from: DCG-Claude
PR: dashpay/rust-dashcore#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/sync/filters.rsdash-spv/src/client/block_processor.rsdash-spv/src/client/mod.rs
📚 Learning: 2025-08-29T04:00:14.154Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-29T04:00:14.154Z
Learning: Applies to {dash-spv,rpc-integration-test}/tests/**/*.rs : Provide integration tests for network operations
Applied to files:
dash-spv/tests/error_recovery_integration_test.rsdash-spv/src/client/mod.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/src/{managed_account,transaction_checking}/**/*.rs : Update wallet state atomically: add transaction, update UTXOs, recalculate balance, and mark addresses used in a single operation
Applied to files:
dash-spv/src/client/block_processor.rskey-wallet-ffi/src/lib.rsdash-spv/src/client/mod.rsdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rs
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/include/dash_spv_ffi.h : The public C header is generated; ensure it reflects FFI changes after builds
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Expose complex Rust types to C as opaque pointers (e.g., FFIDashSpvClient*)
Applied to files:
dash-spv-ffi/FFI_API.mdkey-wallet-ffi/src/lib.rsdash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.py
📚 Learning: 2025-08-16T04:15:57.225Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:15:57.225Z
Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/*.swift : When accessing SPV functionality, use DashSDK public APIs instead of direct client access; add public wrapper methods to DashSDK if needed
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv/src/client/mod.rsdash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Provide corresponding _destroy() functions for all FFI-owned types to enforce explicit memory management
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Functions returning pointers transfer ownership to the caller; functions taking pointers only borrow
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/src/client.rsdash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/examples/wallet_manager_usage.rs
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Return Rust strings to C as *const c_char; allocate so the caller can free with dash_string_free
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/src/client.rs
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Accept input strings from C as *const c_char (borrowed; do not free inputs)
Applied to files:
dash-spv-ffi/FFI_API.md
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/tests/c_tests/**/*.c : In C code, free all strings returned by the FFI using dash_string_free
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/include/dash_spv_ffi.h
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : FFI functions must be declared with #[no_mangle] extern "C"
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/src/client.rs
📚 Learning: 2025-08-16T04:14:07.718Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:14:07.718Z
Learning: Applies to dash-spv-ffi/tests/unit/**/*.rs : Add a corresponding Rust unit test for each new FFI function
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-16T04:15:29.335Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:15:29.335Z
Learning: Applies to swift-dash-core-sdk/Sources/**/FFIBridge.swift : Manage FFI pointers manually using RAII-style wrappers and defer blocks to ensure cleanup
Applied to files:
dash-spv-ffi/FFI_API.mdswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-16T04:15:57.225Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:15:57.225Z
Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/SPVClient.swift : Do not place type definitions in SPVClient.swift; keep types in dedicated files instead
Applied to files:
dash-spv-ffi/FFI_API.mddash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/src/ffi/**/*.rs : Expose safe C FFI with #[no_mangle] extern "C" functions only for vetted APIs
Applied to files:
key-wallet-ffi/src/lib.rskey-wallet-ffi/src/wallet_manager.rs
📚 Learning: 2025-08-25T17:15:59.361Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-08-25T17:15:59.361Z
Learning: Applies to dash-spv/**/*.rs : All code must be clippy-clean: run `cargo clippy --all-targets --all-features -- -D warnings`
Applied to files:
dash-spv/src/client/mod.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/**/*.rs : Include integration tests that cover full wallet workflows
Applied to files:
dash-spv/src/client/mod.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/**/*.rs : Keep test vectors in sync with Dash Core releases
Applied to files:
dash-spv/src/client/mod.rsdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-25T17:15:59.361Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-08-25T17:15:59.361Z
Learning: Applies to dash-spv/tests/**/*.rs : Place integration tests under the `tests/` directory
Applied to files:
dash-spv/src/client/mod.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/bip32_tests.rs : Organize unit tests so key-derivation correctness lives in tests/bip32_tests.rs
Applied to files:
dash-spv/src/client/mod.rsdash-spv-ffi/tests/test_wallet_manager.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/mnemonic_tests.rs : Place mnemonic generation and validation tests in tests/mnemonic_tests.rs
Applied to files:
dash-spv/src/client/mod.rsdash-spv-ffi/tests/test_wallet_manager.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/address_tests.rs : Place address generation and validation tests in tests/address_tests.rs
Applied to files:
dash-spv/src/client/mod.rsdash-spv-ffi/tests/test_wallet_manager.rs
📚 Learning: 2025-08-25T17:15:59.361Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-08-25T17:15:59.361Z
Learning: Applies to dash-spv/tests/integration_real_node_test.rs : Integration tests that connect to a live Dash Core node must gracefully skip when the node at 127.0.0.1:9999 is unavailable
Applied to files:
dash-spv/src/client/mod.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/src/**/*.rs : Always validate network consistency; never mix mainnet and testnet operations
Applied to files:
dash-spv/src/client/mod.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/src/{bip32.rs,dip9.rs} : Keep Dash-specific derivation paths up to date (e.g., DIP-9) in bip32.rs and dip9.rs
Applied to files:
dash-spv-ffi/src/client.rsdash-spv-ffi/examples/wallet_manager_usage.rsdash-spv-ffi/tests/test_wallet_manager.rsdash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-16T04:15:29.335Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:15:29.335Z
Learning: Applies to swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h : After updating dash-spv-ffi, synchronize the generated header into the Swift SDK using ./sync-headers.sh so Sources/DashSPVFFI/include/dash_spv_ffi.h stays up to date
Applied to files:
dash-spv-ffi/dash_spv_ffi.hdash-spv-ffi/include/dash_spv_ffi.hdash-spv-ffi/scripts/generate_ffi_docs.pyswift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/psbt.rs : Place PSBT serialization/deserialization tests in tests/psbt.rs
Applied to files:
dash-spv-ffi/tests/test_wallet_manager.rs
📚 Learning: 2025-08-29T04:01:18.111Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: key-wallet/CLAUDE.md:0-0
Timestamp: 2025-08-29T04:01:18.111Z
Learning: Applies to key-wallet/tests/derivation_tests.rs : Place path derivation tests in tests/derivation_tests.rs
Applied to files:
dash-spv-ffi/tests/test_wallet_manager.rs
📚 Learning: 2025-06-15T15:31:44.136Z
Learnt from: QuantumExplorer
PR: dashpay/rust-dashcore#74
File: key-wallet/src/address.rs:30-40
Timestamp: 2025-06-15T15:31:44.136Z
Learning: In the key-wallet crate, QuantumExplorer prefers keeping wildcard arms that default unknown Network variants to testnet prefixes rather than using exhaustive matches or panics. This fallback behavior is intentional.
Applied to files:
dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-08-16T04:15:29.335Z
Learnt from: CR
PR: dashpay/rust-dashcore#0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-08-16T04:15:29.335Z
Learning: Applies to swift-dash-core-sdk/Sources/**/FFIBridge.swift : Add a Swift wrapper in FFIBridge.swift for each new FFI function, handling type conversions and cross-language error mapping
Applied to files:
swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h
🧬 Code graph analysis (20)
dash-spv/src/storage/mod.rs (5)
dash-spv/src/client/mod.rs (1)
clear_filters(123-156)dash-spv/src/storage/disk.rs (1)
clear_filters(1634-1653)dash-spv/src/storage/memory.rs (1)
clear_filters(310-314)dash-spv/tests/error_handling_test.rs (1)
clear_filters(383-388)dash-spv/tests/error_recovery_integration_test.rs (1)
clear_filters(658-660)
swift-dash-core-sdk/Sources/KeyWalletFFI/include/key_wallet_ffi.h (1)
key-wallet-ffi/src/wallet_manager.rs (2)
wallet_manager_describe(55-88)wallet_manager_free_string(92-98)
dash-spv/tests/error_recovery_integration_test.rs (5)
dash-spv/src/client/mod.rs (1)
clear_filters(123-156)dash-spv/src/storage/disk.rs (1)
clear_filters(1634-1653)dash-spv/src/storage/memory.rs (1)
clear_filters(310-314)dash-spv/src/storage/mod.rs (1)
clear_filters(158-158)dash-spv/tests/error_handling_test.rs (1)
clear_filters(383-388)
key-wallet-ffi/include/key_wallet_ffi.h (1)
key-wallet-ffi/src/wallet_manager.rs (2)
wallet_manager_describe(55-88)wallet_manager_free_string(92-98)
dash-spv/src/client/block_processor.rs (3)
key-wallet-manager/src/wallet_manager/process_block.rs (1)
describe(143-165)dash-spv/src/client/block_processor_test.rs (2)
describe(64-66)describe(244-246)key-wallet-manager/src/wallet_interface.rs (1)
describe(58-60)
key-wallet-ffi/src/lib.rs (1)
key-wallet-ffi/src/wallet_manager.rs (3)
wallet_manager_describe(55-88)wallet_manager_free(897-903)wallet_manager_free_string(92-98)
dash-spv/src/storage/memory.rs (5)
dash-spv/src/client/mod.rs (1)
clear_filters(123-156)dash-spv/src/storage/disk.rs (1)
clear_filters(1634-1653)dash-spv/src/storage/mod.rs (1)
clear_filters(158-158)dash-spv/tests/error_handling_test.rs (1)
clear_filters(383-388)dash-spv/tests/error_recovery_integration_test.rs (1)
clear_filters(658-660)
dash-spv/src/storage/disk.rs (5)
dash-spv/src/client/mod.rs (1)
clear_filters(123-156)dash-spv/src/storage/memory.rs (1)
clear_filters(310-314)dash-spv/src/storage/mod.rs (1)
clear_filters(158-158)dash-spv/tests/error_handling_test.rs (1)
clear_filters(383-388)dash-spv/tests/error_recovery_integration_test.rs (1)
clear_filters(658-660)
key-wallet-manager/src/wallet_manager/process_block.rs (3)
dash-spv/src/client/block_processor_test.rs (2)
describe(64-66)describe(244-246)key-wallet-manager/src/wallet_interface.rs (1)
describe(58-60)key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs (4)
wallet_id(30-30)wallet_id(122-124)name(33-33)name(126-128)
dash-spv/src/client/mod.rs (5)
dash-spv/src/storage/disk.rs (2)
clear_filters(1634-1653)new(210-324)dash-spv/src/storage/memory.rs (2)
clear_filters(310-314)new(30-42)dash-spv/src/storage/mod.rs (1)
clear_filters(158-158)dash-spv/src/types.rs (5)
default(57-70)default(423-425)default(572-601)new(184-186)new(880-900)dash-spv/src/sync/filters.rs (1)
new(266-297)
key-wallet-manager/src/wallet_interface.rs (2)
key-wallet-manager/src/wallet_manager/process_block.rs (1)
describe(143-165)dash-spv/src/client/block_processor_test.rs (2)
describe(64-66)describe(244-246)
key-wallet-ffi/src/wallet_manager.rs (1)
key-wallet-ffi/src/error.rs (3)
error(44-49)set_error(53-59)set_success(63-69)
dash-spv-ffi/src/client.rs (2)
dash-spv-ffi/src/error.rs (1)
set_last_error(26-31)key-wallet-ffi/src/wallet_manager.rs (1)
wallet_manager_free(897-903)
dash-spv-ffi/dash_spv_ffi.h (1)
dash-spv-ffi/src/client.rs (2)
dash_spv_ffi_client_get_wallet_manager(1503-1524)dash_spv_ffi_wallet_manager_free(1536-1542)
dash-spv-ffi/examples/wallet_manager_usage.rs (2)
key-wallet-ffi/src/wallet_manager.rs (1)
wallet_manager_wallet_count(867-887)dash-spv-ffi/src/client.rs (2)
dash_spv_ffi_client_get_wallet_manager(1503-1524)dash_spv_ffi_wallet_manager_free(1536-1542)
dash-spv-ffi/tests/test_wallet_manager.rs (3)
key-wallet-ffi/src/wallet_manager.rs (6)
wallet_manager_free_wallet_ids(914-921)wallet_manager_get_wallet_ids(510-549)wallet_manager_import_wallet_from_bytes(427-498)wallet_manager_wallet_count(867-887)wallet_manager_describe(55-88)wallet_manager_free_string(92-98)dash-spv-ffi/src/client.rs (5)
dash_spv_ffi_wallet_manager_free(1536-1542)dash_spv_ffi_client_destroy(1286-1324)dash_spv_ffi_client_new(140-210)dash_spv_ffi_client_get_wallet_manager(1503-1524)new(80-84)dash-spv-ffi/src/config.rs (2)
dash_spv_ffi_config_destroy(345-354)dash_spv_ffi_config_testnet(54-61)
dash-spv-ffi/include/dash_spv_ffi.h (1)
dash-spv-ffi/src/client.rs (2)
dash_spv_ffi_client_get_wallet_manager(1503-1524)dash_spv_ffi_wallet_manager_free(1536-1542)
dash-spv/src/client/block_processor_test.rs (2)
key-wallet-manager/src/wallet_manager/process_block.rs (1)
describe(143-165)key-wallet-manager/src/wallet_interface.rs (1)
describe(58-60)
swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h (1)
dash-spv-ffi/src/client.rs (2)
dash_spv_ffi_client_get_wallet_manager(1503-1524)dash_spv_ffi_wallet_manager_free(1536-1542)
dash-spv/tests/error_handling_test.rs (5)
dash-spv/src/client/mod.rs (1)
clear_filters(123-156)dash-spv/src/storage/disk.rs (1)
clear_filters(1634-1653)dash-spv/src/storage/memory.rs (1)
clear_filters(310-314)dash-spv/src/storage/mod.rs (1)
clear_filters(158-158)dash-spv/tests/error_recovery_integration_test.rs (1)
clear_filters(658-660)
⏰ 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). (8)
- GitHub Check: fuzz (dash_deserialize_script)
 - GitHub Check: fuzz (hashes_sha512_256)
 - GitHub Check: fuzz (dash_deserialize_amount)
 - GitHub Check: Key Wallet Components Tests
 - GitHub Check: fuzz (hashes_cbor)
 - GitHub Check: fuzz (dash_deser_net_msg)
 - GitHub Check: fuzz (dash_outpoint_string)
 - GitHub Check: Clippy (Non-strict)
 
🔇 Additional comments (16)
dash-spv/src/storage/memory.rs (1)
310-314: clear_filters() implementation matches trait intent; LGTM.Clears both filter_headers and filters; consistent with client reset flow.
dash-spv/src/storage/mod.rs (1)
157-159: clear_filters implemented in all StorageManager implsdash-spv/tests/error_recovery_integration_test.rs (1)
658-660: No-op clear_filters for mock looks goodImplements the new trait method to unblock compilation of ignored tests. Matches the trait contract and keeps behavior simple for this integration test scaffold.
dash-spv/tests/error_handling_test.rs (1)
383-389: Mock clear_filters mirrors write-failure path — OKConsistent with other mock write ops (e.g., clear, store_*). This keeps tests deterministic when fail_on_write is set.
dash-spv/src/storage/disk.rs (1)
1634-1653: LGTM! Clean filter reset implementation.The
clear_filtersimplementation correctly follows the established pattern, properly stopping the background worker before filesystem operations to prevent concurrent writes, clearing all filter-related state, and restarting the worker afterward.dash-spv-ffi/examples/wallet_manager_usage.rs (2)
8-8: LGTM! Correctly updated to use the new typed wallet manager API.The changes properly align with the new wallet management lifecycle API, using the typed
FFIWalletManagerpointer returned bydash_spv_ffi_client_get_wallet_manager.Also applies to: 24-29
36-39: LGTM! Proper memory management with the new API.The cast to
*const FFIWalletManagercorrectly enforces read-only access as per the FFI design principles. The use ofdash_spv_ffi_wallet_manager_freeensures proper cleanup of the typed wallet manager handle.Based on learnings
Also applies to: 69-69
dash-spv/src/client/mod.rs (2)
122-156: LGTM! Comprehensive filter state reset implementation.The
clear_filtersmethod properly coordinates the reset across all components - storage, in-memory state, sync manager, and statistics. Good use of scoped blocks to minimize lock duration.
2567-2620: LGTM! Well-structured test for wallet manager integration.The test effectively validates the shared wallet manager functionality, demonstrating proper wallet import and description retrieval through the new typed API.
dash-spv-ffi/src/client.rs (2)
1536-1542: Forwarder free is fine; ensure symbol visibility from key-wallet-ffi.Calling
key_wallet_ffi::wallet_manager::wallet_manager_free(manager)keeps lifetime rules centralized. Confirm thewallet_managermodule ispubinkey-wallet-ffiso this path resolves; if not, call the crate-root re-export (e.g.,key_wallet_ffi::wallet_manager_free).
1503-1524: Exports and headers are correct; no action needed. FFIWalletManager::from_arc is public under key_wallet_ffi::FFIWalletManager, and the headers exposedash_spv_ffi_client_get_wallet_managerreturningFFIWalletManager*.dash-spv-ffi/tests/test_wallet_manager.rs (1)
41-45: Use the new free function — LGTMSwitch to dash_spv_ffi_wallet_manager_free is appropriate and aligns lifetimes across crates.
swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h (1)
534-550: Qualify FFIWalletManager pointer asstructand sync headers
- Change the signature in
 dash-spv-ffi/include/dash_spv_ffi.h(line 549) fromtoFFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client);struct FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client);- Run
 ./sync-headers.shto propagate this change into
swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.hso both headers stay in lockstep.⛔ Skipped due to learnings
Learnt from: CR PR: dashpay/rust-dashcore#0 File: swift-dash-core-sdk/CLAUDE.md:0-0 Timestamp: 2025-08-16T04:15:29.335Z Learning: Applies to swift-dash-core-sdk/Sources/DashSPVFFI/include/dash_spv_ffi.h : After updating dash-spv-ffi, synchronize the generated header into the Swift SDK using ./sync-headers.sh so Sources/DashSPVFFI/include/dash_spv_ffi.h stays up to dateLearnt from: CR PR: dashpay/rust-dashcore#0 File: dash-spv-ffi/CLAUDE.md:0-0 Timestamp: 2025-08-16T04:14:07.718Z Learning: Applies to dash-spv-ffi/include/dash_spv_ffi.h : The public C header is generated; ensure it reflects FFI changes after buildsLearnt from: CR PR: dashpay/rust-dashcore#0 File: CLAUDE.md:0-0 Timestamp: 2025-08-29T04:00:14.154Z Learning: Applies to {dash-network-ffi,dash-spv-ffi,key-wallet-ffi,swift-dash-core-sdk}/**/*.{rs,c,h,swift} : Be careful with memory management at FFI boundaries (C/Swift interop)Learnt from: CR PR: dashpay/rust-dashcore#0 File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0 Timestamp: 2025-08-16T04:15:57.225Z Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/*.swift : When accessing SPV functionality, use DashSDK public APIs instead of direct client access; add public wrapper methods to DashSDK if neededLearnt from: CR PR: dashpay/rust-dashcore#0 File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0 Timestamp: 2025-08-16T04:15:57.225Z Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/SPVClient.swift : Do not place type definitions in SPVClient.swift; keep types in dedicated files insteadLearnt from: CR PR: dashpay/rust-dashcore#0 File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0 Timestamp: 2025-08-16T04:15:57.225Z Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/HDWalletModels.swift : Define SwiftData models (HDWallet, HDAccount, WatchedAddress, SyncState) in HDWalletModels.swiftLearnt from: CR PR: dashpay/rust-dashcore#0 File: dash-spv-ffi/CLAUDE.md:0-0 Timestamp: 2025-08-16T04:14:07.718Z Learning: Applies to dash-spv-ffi/src/**/*.rs : Expose complex Rust types to C as opaque pointers (e.g., FFIDashSpvClient*)Learnt from: QuantumExplorer PR: dashpay/rust-dashcore#108 File: key-wallet-ffi/src/wallet_manager.rs:270-318 Timestamp: 2025-08-21T05:01:58.949Z Learning: In the key-wallet-ffi design, wallets retrieved from the wallet manager via lookup functions should return const pointers (*const FFIWallet) to enforce read-only access and prevent unintended modifications. The wallet manager should control wallet lifecycle and mutations through specific APIs rather than allowing external mutation of retrieved wallet references.key-wallet-ffi/src/wallet_manager.rs (3)
22-22: Good: trait import enablesdescribemethod resolutionBringing
WalletInterfaceinto scope is required for the extension method; this is correct.
69-69: Reentrancy risk:Runtime::block_onif already on this runtimeIf this FFI is ever called from a task running on the same Tokio runtime,
block_oncan panic or deadlock. Consider documenting that these FFI calls must be invoked off-runtime threads, or gate with a check/fallback (e.g., delegate to async path exposed elsewhere).Can you confirm these FFI entrypoints are never invoked from within the same runtime?
74-87: CString creation and error propagation look correctConverts to a C string with NUL-checking and sets
FFIErrorappropriately. LGTM.
| * Returns a pointer to an `FFIWalletManager` wrapper that clones the underlying | ||
| * `Arc<RwLock<WalletManager>>`. This allows direct interaction with the wallet | ||
| * manager without going back through the client for each call. | ||
| * | ||
| * # Safety | ||
| * | ||
| * The caller must ensure that: | ||
| * - The client pointer is valid | ||
| * - The returned pointer is freed using `wallet_manager_free` from key-wallet-ffi | ||
| * - The returned pointer is released exactly once using | ||
| * `dash_spv_ffi_wallet_manager_free` | ||
| * | ||
| * # Returns | ||
| * | ||
| * An opaque pointer (void*) to the wallet manager, or NULL if the client is not initialized. | ||
| * Swift should treat this as an OpaquePointer. | ||
| * Get a handle to the wallet manager owned by this client. | ||
| * A pointer to the wallet manager wrapper, or NULL if the client is not initialized. | ||
| */ | ||
| FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) ; | ||
| 
               | 
          
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.
Blocker: FFIWalletManager not declared in this header — switch prototypes to struct-qualified to avoid compile error
FFIWalletManager is used but no typedef/forward-declaration exists in this file. C/Swift consumers will see “unknown type name ‘FFIWalletManager’”. Fix locally by using struct-qualified pointers in the signatures. Apply:
- FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) ;
+ struct FFIWalletManager *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) ;Optionally, also re-export the type in dash-spv-ffi (e.g., pub use key_wallet_ffi::FFIWalletManager;) so cbindgen emits a proper typedef on future generations. Based on learnings.
| /** | ||
| * Release a wallet manager obtained from `dash_spv_ffi_client_get_wallet_manager`. | ||
| * | ||
| * This simply forwards to `wallet_manager_free` in key-wallet-ffi so that | ||
| * lifetime management is consistent between direct key-wallet usage and the | ||
| * SPV client pathway. | ||
| * | ||
| * # Safety | ||
| * - `client` must be a valid, non-null pointer. | ||
| * - `manager` must either be null or a pointer previously returned by | ||
| * `dash_spv_ffi_client_get_wallet_manager`. | ||
| */ | ||
| 
               | 
          ||
| void *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) | ||
| ; | ||
| void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager) ; | ||
| 
               | 
          
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.
🧩 Analysis chain
Make free signature struct-qualified as well for consistency and C-compat
Mirror the change in the free function to avoid the same undefined type:
- void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager) ;
+ void dash_spv_ffi_wallet_manager_free(struct FFIWalletManager *manager) ;Also re-run header generation and sync to SDK after adjusting. Based on learnings.
Run to verify header health:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Check FFIWalletManager usage:"
rg -n "FFIWalletManager" dash-spv-ffi/dash_spv_ffi.h | sed -n '1,200p'
echo "Ensure a declaration exists (typedef or struct-qualified usage):"
rg -nP 'typedef\s+struct\s+FFIWalletManager|struct\s+FFIWalletManager\s*\*' dash-spv-ffi/dash_spv_ffi.h
echo "Check FFINetwork is declared (required by many functions):"
rg -nP 'typedef\s+enum\s+FFINetwork|enum\s+FFINetwork\b' dash-spv-ffi/dash_spv_ffi.hLength of output: 348
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Search for inline struct definition in header:"
rg -nP 'struct\s+FFIWalletManager\s*\{' dash-spv-ffi/dash_spv_ffi.h || echo "No inline struct definition found."
echo
echo "Search for typedef alias in header:"
rg -nP 'typedef\s+struct\s+FFIWalletManager\s+FFIWalletManager' dash-spv-ffi/dash_spv_ffi.h || echo "No typedef alias found."
echo
echo "Search entire dash-spv-ffi directory for any struct/typedef of FFIWalletManager:"
rg -nH -n 'FFIWalletManager' -C2 dash-spv-ffiLength of output: 10333
Qualify FFIWalletManager as an opaque struct in the C header
In dash_spv_ffi_wallet_manager_free, change the parameter from a bare FFIWalletManager* to struct FFIWalletManager* to match other opaque types (e.g. struct FFIClientConfig*) and avoid undefined-type errors:
- void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager);
+ void dash_spv_ffi_wallet_manager_free(struct FFIWalletManager *manager);After applying this, re-generate the C header and re-run ./sync-headers.sh to update the Swift SDK.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Release a wallet manager obtained from `dash_spv_ffi_client_get_wallet_manager`. | |
| * | |
| * This simply forwards to `wallet_manager_free` in key-wallet-ffi so that | |
| * lifetime management is consistent between direct key-wallet usage and the | |
| * SPV client pathway. | |
| * | |
| * # Safety | |
| * - `client` must be a valid, non-null pointer. | |
| * - `manager` must either be null or a pointer previously returned by | |
| * `dash_spv_ffi_client_get_wallet_manager`. | |
| */ | |
| void *dash_spv_ffi_client_get_wallet_manager(struct FFIDashSpvClient *client) | |
| ; | |
| void dash_spv_ffi_wallet_manager_free(FFIWalletManager *manager) ; | |
| /** | |
| * Release a wallet manager obtained from `dash_spv_ffi_client_get_wallet_manager`. | |
| * | |
| * This simply forwards to `wallet_manager_free` in key-wallet-ffi so that | |
| * lifetime management is consistent between direct key-wallet usage and the | |
| * SPV client pathway. | |
| * | |
| * # Safety | |
| * - `manager` must either be null or a pointer previously returned by | |
| * `dash_spv_ffi_client_get_wallet_manager`. | |
| */ | |
| void dash_spv_ffi_wallet_manager_free(struct FFIWalletManager *manager); | 
🤖 Prompt for AI Agents
In dash-spv-ffi/dash_spv_ffi.h around lines 551 to 563, the function parameter
uses a bare FFIWalletManager* which is inconsistent with other opaque types and
can trigger undefined-type errors; change the signature to accept struct
FFIWalletManager* instead of FFIWalletManager* to match the header's opaque type
declarations, then re-generate the C header and run ./sync-headers.sh to
propagate the updated declaration to the Swift SDK.
| // Get wallet manager (shares ownership with the client) | ||
| FFIWalletManager* wallet_manager = dash_spv_ffi_client_get_wallet_manager(client); | ||
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.
Example leaks the wallet manager; add a free call.
The “Basic SPV Client Usage” example obtains FFIWalletManager* but never frees it. This encourages leaks in client code. Add dash_spv_ffi_wallet_manager_free(wallet_manager); (before destroying the client or right after use).
Apply this diff to the example:
 // Get wallet manager (shares ownership with the client)
 FFIWalletManager* wallet_manager = dash_spv_ffi_client_get_wallet_manager(client);
+// Free the wallet manager when done
+dash_spv_ffi_wallet_manager_free(wallet_manager);
+wallet_manager = NULL;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Get wallet manager (shares ownership with the client) | |
| FFIWalletManager* wallet_manager = dash_spv_ffi_client_get_wallet_manager(client); | |
| // Get wallet manager (shares ownership with the client) | |
| FFIWalletManager* wallet_manager = dash_spv_ffi_client_get_wallet_manager(client); | |
| // Free the wallet manager when done | |
| dash_spv_ffi_wallet_manager_free(wallet_manager); | |
| wallet_manager = NULL; | 
🤖 Prompt for AI Agents
In dash-spv-ffi/FFI_API.md around lines 1309 to 1311, the example obtains an
FFIWalletManager* via dash_spv_ffi_client_get_wallet_manager(client) but never
frees it; add a call to dash_spv_ffi_wallet_manager_free(wallet_manager) after
you finish using the wallet_manager (either immediately after its last use in
the example or before destroying the client) to avoid leaking the wallet
manager.
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 (1)
Cargo.toml (1)
5-6: Addrust-versionfield to comply with MSRV requirement.Per coding guidelines, the MSRV is 1.89 and should be set in Cargo.toml.
As per coding guidelines.
Apply this diff to add the required field:
[workspace.package] version = "0.40.0" +rust-version = "1.89"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Cargo.toml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/Cargo.toml
📄 CodeRabbit inference engine (AGENTS.md)
MSRV is 1.89; set and respect rust-version = "1.89" in Cargo.toml
Files:
Cargo.toml
🪛 GitHub Actions: Continuous integration
Cargo.toml
[warning] 1-1: Patch elliptic-curve-tools was not used in the crate graph. Check patch version compatibility and run cargo update if needed.
⏰ 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). (1)
- GitHub Check: fuzz (hashes_sha1)
 
          
 | 
    
Summary by CodeRabbit
New Features
Improvements
Tests
Documentation
Chores