Skip to content

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Dec 18, 2025

Capture the new addresses generated by the gap limit maintaining and pass them through to the process_block caller in a BlockProcessingResult. Will be used in a later PR to rescan new addresses during sync.

Tests currently still fail, requires:

Summary by CodeRabbit

  • Refactor

    • Block and transaction processing now return richer result objects that include relevant transaction IDs and newly discovered addresses; public APIs updated accordingly.
  • Tests

    • Integration and unit tests expanded for multi-transaction blocks, address-monitoring growth, and empty-result scenarios.
    • Added a test helper to create transactions targeting a specific address.
  • Chores

    • Added a dev test dependency for testing utilities.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

📝 Walkthrough

Walkthrough

Block and transaction processing returns were replaced with structured results: BlockProcessingResult (with relevant_txids and new_addresses) and CheckTransactionsResult (with affected_wallets and new_addresses); call sites, tests, logging, and event payloads were updated to use the new result fields.

Changes

Cohort / File(s) Summary
Result Type Definitions
key-wallet-manager/src/wallet_interface.rs, key-wallet-manager/src/lib.rs
Added public BlockProcessingResult { pub relevant_txids: Vec<Txid>, pub new_addresses: Vec<Address> } and re-exported it; changed WalletInterface::process_block to return BlockProcessingResult.
Transaction-checking result
key-wallet/src/transaction_checking/account_checker.rs, key-wallet/src/transaction_checking/wallet_checker.rs
Added pub new_addresses: Vec<Address> to TransactionCheckResult; made accumulation mutable and extend new_addresses from gap-limit maintenance results; errors logged instead of ignored.
WalletManager: transaction checks
key-wallet-manager/src/wallet_manager/mod.rs
Added public CheckTransactionsResult { pub affected_wallets: Vec<WalletId>, pub new_addresses: Vec<Address> }; check_transaction_in_all_wallets now returns and populates this struct.
WalletManager: block processing
key-wallet-manager/src/wallet_manager/process_block.rs
process_block now returns BlockProcessingResult; accumulates result.relevant_txids and result.new_addresses from per-transaction checks and returns the result.
Call sites / Consumers
dash-spv/src/client/block_processor.rs, dash-spv/src/sync/message_handlers.rs, key-wallet-ffi/src/wallet_manager.rs
Call sites updated to capture the returned result and use result.relevant_txids (counts, iteration, event fields); local bindings renamed where appropriate and checks switched to result.affected_wallets/result.new_addresses.
Tests & Test utilities
dash-spv/src/client/block_processor_test.rs, key-wallet-manager/tests/spv_integration_tests.rs, test-utils/src/builders.rs, key-wallet-manager/Cargo.toml
Tests and mocks updated to use BlockProcessingResult; integration tests extended to multi-tx scenarios and assert new addresses; added create_transaction_to_address helper and added dashcore-test-utils as a dev-dependency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped through code with keen delight,

Gathered txids in a cozy sight,
New addresses tucked in rows,
Results now tell wallets what they know,
Hooray — structured hops make logic light!

Pre-merge checks and finishing touches

✅ 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 'feat: Capture new addresses from maintain_gap_limit' clearly describes the primary change: capturing newly generated addresses from the gap-limit maintenance routine and returning them through a result structure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

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.

@xdustinface
Copy link
Collaborator Author

Reopen to trigger CI.

@xdustinface xdustinface reopened this Dec 19, 2025
@xdustinface xdustinface marked this pull request as ready for review December 19, 2025 00:44
@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Dec 19, 2025
@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.

@xdustinface xdustinface force-pushed the feat/capture-new-addresses branch from 5ac6510 to c108a63 Compare December 20, 2025 08:34
@github-actions github-actions bot removed the merge-conflict The PR conflicts with the target branch. label Dec 20, 2025
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

🧹 Nitpick comments (2)
key-wallet-manager/src/wallet_manager/mod.rs (1)

542-542: Consider deduplication if multiple wallets could generate identical addresses.

The code aggregates addresses from all wallets without deduplication. While proper key derivation should prevent address collisions between wallets, consider using a BTreeSet or deduplicating before returning if duplicate addresses could cause issues in downstream rescanning logic.

💡 Optional deduplication approach

If deduplication is desired:

// At the end of the function, before returning
result.new_addresses.sort();
result.new_addresses.dedup();

Or collect into a set during aggregation:

// Change CheckTransactionsResult.new_addresses to BTreeSet<Address>
// Then use insert instead of extend
result.new_addresses.extend(check_result.new_addresses);
key-wallet/src/transaction_checking/wallet_checker.rs (1)

396-900: Consider adding test coverage for the new_addresses field.

The test suite doesn't verify that new_addresses is correctly populated when gap limit maintenance generates new addresses. Consider adding tests to ensure:

  • new_addresses contains addresses generated during gap limit maintenance
  • new_addresses is empty when no new addresses are generated
  • Addresses are captured from both external and internal address pools

Note: If this is covered by PR #286, you can disregard this comment.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ac6510 and c108a63.

📒 Files selected for processing (13)
  • dash-spv/src/client/block_processor.rs (3 hunks)
  • dash-spv/src/client/block_processor_test.rs (3 hunks)
  • dash-spv/src/sync/message_handlers.rs (1 hunks)
  • key-wallet-ffi/src/wallet_manager.rs (1 hunks)
  • key-wallet-manager/Cargo.toml (1 hunks)
  • key-wallet-manager/src/lib.rs (1 hunks)
  • key-wallet-manager/src/wallet_interface.rs (1 hunks)
  • key-wallet-manager/src/wallet_manager/mod.rs (4 hunks)
  • key-wallet-manager/src/wallet_manager/process_block.rs (3 hunks)
  • key-wallet-manager/tests/spv_integration_tests.rs (2 hunks)
  • key-wallet/src/transaction_checking/account_checker.rs (2 hunks)
  • key-wallet/src/transaction_checking/wallet_checker.rs (2 hunks)
  • test-utils/src/builders.rs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • key-wallet-manager/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (4)
  • dash-spv/src/sync/message_handlers.rs
  • key-wallet-ffi/src/wallet_manager.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
🧰 Additional context used
📓 Path-based instructions (6)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Never hardcode network parameters, addresses, or keys in Rust code
Use proper error types with thiserror crate and propagate errors appropriately in Rust code
Use tokio runtime for async operations in Rust code
Use conditional compilation with feature flags for optional features
Write unit tests for new functionality in Rust
Format Rust code with cargo fmt before committing
Ensure clippy passes with all warnings as errors on all Rust code

**/*.rs: Each crate keeps sources in src/; unit tests live alongside code with #[cfg(test)]
Maintain MSRV of 1.89 for Rust code
Format Rust code with rustfmt (see rustfmt.toml); run cargo fmt --all before commits
Lint Rust code with clippy; avoid unwrap()/expect() in library code; use error types (e.g., thiserror)
Use snake_case for function and variable names in Rust
Use UpperCamelCase for types and traits in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow mixed editions (2021/2024) and crate-specific idioms; prefer async via tokio where applicable
Unit tests should be placed near code with descriptive names (e.g., test_parse_address_mainnet)
Use #[ignore] for network-dependent or long-running tests; run with -- --ignored flag
Never commit secrets or real keys; avoid logging sensitive data in Rust code
Keep test vectors deterministic in Rust test code

Files:

  • key-wallet-manager/src/lib.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • test-utils/src/builders.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.rs
key-wallet/**/*.rs

📄 CodeRabbit inference engine (key-wallet/CLAUDE.md)

key-wallet/**/*.rs: Separate immutable structures (Account, Wallet) containing only identity information from mutable wrappers (ManagedAccount, ManagedWalletInfo) with state management
Never serialize or log private keys in production; use public keys or key fingerprints for identification instead
Always validate network consistency when deriving or validating addresses; never mix mainnet and testnet operations
Use BTreeMap for ordered data (accounts, transactions) and HashMap for lookups (address mappings); apply memory management strategies for old transaction data
Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations
Use the ? operator for error propagation, provide context in error messages, never panic in library code, and return Result<T> for all fallible operations

Files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
key-wallet/**/transaction_checking/**/*.rs

📄 CodeRabbit inference engine (key-wallet/CLAUDE.md)

Implement transaction classification and routing through TransactionRouter to avoid checking all accounts for every transaction

Files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
**/tests/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/tests/**/*.rs: Write integration tests for network operations in Rust
Test both mainnet and testnet configurations
Use proptest for property-based testing where appropriate in Rust

Integration tests use tests/ directory (e.g., rpc-integration-test)

Files:

  • key-wallet-manager/tests/spv_integration_tests.rs
dash-spv/**/*.rs

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

dash-spv/**/*.rs: Use async/await throughout the codebase, built on tokio runtime
Use Arc for trait objects to enable runtime polymorphism for NetworkManager and StorageManager
Use Tokio channels for inter-component message passing between async tasks
Maintain minimum Rust version (MSRV) of 1.89 and use only compatible syntax and features

Files:

  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.rs
dash-spv/src/client/**/*.rs

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

Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization

Files:

  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.rs
🧠 Learnings (33)
📓 Common learnings
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/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory
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/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues
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/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together
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/**/transaction_checking/**/*.rs : Implement transaction classification and routing through `TransactionRouter` to avoid checking all accounts for every transaction
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 `BTreeMap` for ordered data (accounts, transactions) and `HashMap` for lookups (address mappings); apply memory management strategies for old transaction data
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.
📚 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:

  • key-wallet-manager/src/lib.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.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/**/address_pool/**/*.rs : Support multiple `KeySource` variants (Private, Public, NoKeySource) to enable both full wallets and watch-only wallets with the same interface

Applied to files:

  • key-wallet-manager/src/lib.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.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:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.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 `BTreeMap` for ordered data (accounts, transactions) and `HashMap` for lookups (address mappings); apply memory management strategies for old transaction data

Applied to files:

  • key-wallet-manager/src/lib.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.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/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together

Applied to files:

  • key-wallet-manager/src/lib.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • dash-spv/src/client/block_processor.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/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.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/**/transaction_checking/**/*.rs : Implement transaction classification and routing through `TransactionRouter` to avoid checking all accounts for every transaction

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.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/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.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/**/address_pool/**/*.rs : Pre-generate addresses in batches (typically 20-100) and store them in pools; only derive on-demand when the pool is exhausted

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.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 : Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Organize tests into unit tests (in-module), integration tests (tests/ directory), real network tests (with live Dash Core nodes), and performance benchmarks

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.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:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.rs
📚 Learning: 2025-12-01T08:01:18.174Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T08:01:18.174Z
Learning: Cover critical parsing, networking, SPV, and wallet flows with tests; add regression tests for fixes; consider property tests with `proptest`

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.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:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Implement sequential phase-based synchronization via SyncManager with phases progressing in order: Headers → Masternode List → Filter Headers → Filters → Blocks

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.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/**/tests/**/*.rs : Organize unit tests by functionality: separate test files for BIP32, mnemonics, addresses, derivation paths, and PSBT operations

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Integration tests should gracefully handle unavailable Dash Core nodes at 127.0.0.1:9999 without failing the test suite

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/validation/**/*.rs : Implement three validation modes: ValidationMode::None (no validation), ValidationMode::Basic (structure and timestamp validation), and ValidationMode::Full (complete PoW and chain validation)

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-01T08:01:00.652Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:01:00.652Z
Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/*.swift : Enable mempool tracking on SPV connection using the appropriate strategy (.fetchAll, .bloomFilter, .selective)

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/client/**/*.rs : Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.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:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
📚 Learning: 2025-12-01T08:00:50.618Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:50.618Z
Learning: When making changes to Rust FFI in dash-spv-ffi, rebuild with `cargo build --release` and run Swift tests to verify integration

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-01T08:00:50.618Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:00:50.618Z
Learning: Applies to swift-dash-core-sdk/**/*.rs : Implement new FFI functions in Rust with `#[no_mangle] extern "C"` annotation in dash-spv-ffi

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-01T08:01:00.652Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: swift-dash-core-sdk/Examples/DashHDWalletExample/CLAUDE.md:0-0
Timestamp: 2025-12-01T08:01:00.652Z
Learning: Applies to swift-dash-core-sdk/Examples/DashHDWalletExample/**/*.swift : Use DashSDK's public methods, not direct SPVClient access, when accessing SPV functionality in Swift code

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/error.rs : Use domain-specific error types (NetworkError, StorageError, SyncError, ValidationError, SpvError) rather than generic error handling

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-01T08:01:18.174Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-01T08:01:18.174Z
Learning: Organize workspace with crates: `dash`, `hashes`, `internals`, `dash-network`, `dash-spv`, `key-wallet`, `rpc-*`, utilities (`fuzz`, `test-utils`), and FFI crates (`*-ffi`)

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase, built on tokio runtime

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/block_processor.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use Tokio channels for inter-component message passing between async tasks

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use Arc<dyn TraitName> for trait objects to enable runtime polymorphism for NetworkManager and StorageManager

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/network/**/*.rs : Implement configurable timeouts with recovery mechanisms for network operations

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-06-26T15:47:37.438Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:47:37.438Z
Learning: Transaction IDs (txids) and block hashes in Dash are always 32 bytes and should be passed as fixed-size byte arrays in FFI interfaces, not as C strings, to avoid inefficiency and encoding issues.

Applied to files:

  • dash-spv/src/client/block_processor.rs
🧬 Code graph analysis (2)
key-wallet-manager/tests/spv_integration_tests.rs (3)
test-utils/src/builders.rs (3)
  • create_transaction_to_address (164-169)
  • new (36-38)
  • new (111-113)
dash-spv/src/types.rs (1)
  • txid (1008-1010)
key-wallet-manager/src/wallet_manager/mod.rs (2)
  • new (80-86)
  • new (117-124)
dash-spv/src/client/block_processor.rs (3)
dash-spv/src/client/core.rs (1)
  • wallet (158-160)
dash-spv-ffi/src/client.rs (1)
  • txid (273-273)
dash-spv/src/types.rs (1)
  • txid (1008-1010)
⏰ 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). (20)
  • GitHub Check: fuzz (hashes_cbor)
  • GitHub Check: fuzz (dash_deser_net_msg)
  • GitHub Check: fuzz (dash_deserialize_block)
  • GitHub Check: fuzz (dash_deserialize_script)
  • GitHub Check: fuzz (hashes_sha256)
  • GitHub Check: fuzz (hashes_json)
  • GitHub Check: fuzz (dash_deserialize_address)
  • GitHub Check: fuzz (dash_script_bytes_to_asm_fmt)
  • GitHub Check: fuzz (hashes_sha512_256)
  • GitHub Check: fuzz (hashes_sha512)
  • GitHub Check: fuzz (hashes_sha1)
  • GitHub Check: fuzz (hashes_ripemd160)
  • GitHub Check: fuzz (dash_deserialize_amount)
  • GitHub Check: fuzz (dash_outpoint_string)
  • GitHub Check: fuzz (dash_deserialize_witness)
  • GitHub Check: RPC Tests (stable, true)
  • GitHub Check: SPV Components Tests
  • GitHub Check: Core Components Tests
  • GitHub Check: Pre-commit (ubuntu-latest)
  • GitHub Check: Pre-commit (macos-latest)
🔇 Additional comments (15)
key-wallet-manager/src/lib.rs (1)

43-43: LGTM: Public API addition aligns with structured result pattern.

The re-export of BlockProcessingResult appropriately exposes the new structured return type to crate consumers, replacing the previous raw Vec<Txid> pattern with a more extensible structure.

test-utils/src/builders.rs (1)

164-169: LGTM: Clean test utility for address-targeted transactions.

The helper function provides a straightforward way to create test transactions directed to specific addresses, which is useful for testing address monitoring and transaction relevance detection.

dash-spv/src/client/block_processor.rs (2)

229-245: LGTM: Refactored to use structured BlockProcessingResult.

The update correctly accesses result.relevant_txids from the new structured return type, improving code clarity and type safety.


229-279: Verify: new_addresses field is captured but unused.

The BlockProcessingResult.new_addresses field is returned from wallet.process_block but never accessed in this file. Per the PR description, this is intended "to enable a later PR to rescan newly generated addresses during synchronization."

Please confirm this is the intended design and that the follow-up PR is planned soon to utilize this data. If the delay is significant, consider documenting this with a TODO comment to avoid confusion.

key-wallet-manager/tests/spv_integration_tests.rs (3)

3-10: LGTM: Updated imports support enhanced test scenarios.

The expanded imports enable construction of targeted test transactions and validation of block processing results, aligning with the new BlockProcessingResult structure.


106-136: LGTM: Comprehensive test validates BlockProcessingResult fields.

The test effectively validates:

  • relevant_txids correctly filters transactions affecting monitored addresses (tx1 and tx2) while ignoring external addresses (tx3)
  • new_addresses accurately reports newly generated addresses from gap limit maintenance
  • Address cache consistency after block processing

This provides solid coverage for the new structured result type.


138-157: LGTM: Test validates empty result for unrelated transactions.

The negative test case correctly verifies that transactions to external addresses produce an empty BlockProcessingResult, ensuring the filtering logic works as expected.

dash-spv/src/client/block_processor_test.rs (3)

11-11: LGTM: Import added for new result type.


49-57: LGTM: Mock updated to return BlockProcessingResult.

The mock wallet correctly returns the structured result with relevant_txids populated from block transactions and an empty new_addresses vector, which is appropriate for test scenarios.


280-281: LGTM: Non-matching wallet returns default result.

Using BlockProcessingResult::default() appropriately indicates no matches, which should produce empty vectors for both fields.

key-wallet-manager/src/wallet_manager/mod.rs (2)

52-59: LGTM! Well-structured result type.

The new CheckTransactionsResult struct clearly captures both affected wallets and newly generated addresses. The Default derive enables clean initialization.


520-543: Verify check_transaction return type and update all call sites.

The implementation correctly aggregates new_addresses from each wallet's check_transaction result. Verification confirms:

  1. The check_transaction method returns TransactionCheckResult with is_relevant: bool and new_addresses: Vec<Address> fields
  2. All call sites of check_transaction_in_all_wallets handle the new CheckTransactionsResult return type correctly, accessing affected_wallets and new_addresses as expected
key-wallet/src/transaction_checking/wallet_checker.rs (1)

78-78: LGTM!

The mutation is necessary to accumulate new addresses generated during gap limit maintenance.

key-wallet/src/transaction_checking/account_checker.rs (2)

41-42: LGTM!

The new new_addresses field is properly documented and typed correctly for capturing addresses generated during gap limit maintenance.


289-289: LGTM!

The field is properly initialized with an empty vector, which will be populated during gap limit maintenance when state updates are performed.

@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Dec 24, 2025
@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.

@xdustinface xdustinface force-pushed the feat/capture-new-addresses branch from d59fe60 to 46fc77a Compare December 24, 2025 06:32
@github-actions github-actions bot removed the merge-conflict The PR conflicts with the target branch. label Dec 24, 2025
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

🧹 Nitpick comments (1)
key-wallet-manager/tests/spv_integration_tests.rs (1)

104-116: Index safety: Test assumes at least 2 pre-generated addresses.

The test indexes addresses[0] and addresses[1] (lines 114-115) but only asserts !addresses.is_empty() (line 105). While WalletAccountCreationOptions::Default likely pre-generates 20+ addresses (based on typical gap limits), the test is fragile without explicit verification.

Optional: More robust assertion
     let addresses = manager.monitored_addresses();
-    assert!(!addresses.is_empty());
+    assert!(addresses.len() >= 2, "Need at least 2 pre-generated addresses for test");
     let external = dashcore::Address::p2pkh(
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c108a63 and 46fc77a.

📒 Files selected for processing (13)
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/sync/message_handlers.rs
  • key-wallet-ffi/src/wallet_manager.rs
  • key-wallet-manager/Cargo.toml
  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • test-utils/src/builders.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • key-wallet-ffi/src/wallet_manager.rs
  • key-wallet-manager/src/lib.rs
  • dash-spv/src/sync/message_handlers.rs
  • test-utils/src/builders.rs
  • key-wallet-manager/Cargo.toml
  • key-wallet/src/transaction_checking/account_checker.rs
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CLAUDE.md)

Never hardcode network parameters, addresses, or keys

Files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Use proper error types (thiserror) and propagate errors appropriately
Use tokio runtime for async operations
Use conditional compilation with feature flags for optional features
Write unit tests for new functionality
Use secure random number generation for keys
Never log or expose private keys
Code must target Rust 1.89 minimum supported version (MSRV)
Format code using cargo fmt
Pass clippy linting without warnings

**/*.rs: MSRV (Minimum Supported Rust Version) is 1.89; ensure compatibility with this version for all builds
Unit tests should live alongside code with #[cfg(test)] annotation; integration tests use the tests/ directory
Use snake_case for function and variable names
Use UpperCamelCase for types and traits
Use SCREAMING_SNAKE_CASE for constants
Format code with rustfmt before commits; ensure cargo fmt --all is run
Run cargo clippy --workspace --all-targets -- -D warnings for linting; avoid warnings in CI
Prefer async/await via tokio for asynchronous operations

Files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
**/tests/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/tests/**/*.rs: Create integration tests for network operations
Test both mainnet and testnet configurations
Use proptest for property-based testing where appropriate

**/tests/**/*.rs: Use descriptive test names (e.g., test_parse_address_mainnet)
Mark network-dependent or long-running tests with #[ignore] and run with -- --ignored

Files:

  • key-wallet-manager/tests/spv_integration_tests.rs
dash-spv/**/*.rs

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

dash-spv/**/*.rs: Use async/await throughout the codebase, built on tokio runtime
Use Arc for trait objects to enable runtime polymorphism for NetworkManager and StorageManager
Use Tokio channels for inter-component message passing between async tasks
Maintain minimum Rust version (MSRV) of 1.89 and use only compatible syntax and features

Files:

  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
dash-spv/src/client/**/*.rs

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

Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization

Files:

  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
**/{dash-network,dash-spv,key-wallet}/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Use async/await for async operations in network and wallet modules

Files:

  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
key-wallet/**/*.rs

📄 CodeRabbit inference engine (key-wallet/CLAUDE.md)

key-wallet/**/*.rs: Separate immutable structures (Account, Wallet) containing only identity information from mutable wrappers (ManagedAccount, ManagedWalletInfo) with state management
Never serialize or log private keys in production; use public keys or key fingerprints for identification instead
Always validate network consistency when deriving or validating addresses; never mix mainnet and testnet operations
Use BTreeMap for ordered data (accounts, transactions) and HashMap for lookups (address mappings); apply memory management strategies for old transaction data
Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations
Use the ? operator for error propagation, provide context in error messages, never panic in library code, and return Result<T> for all fallible operations

Files:

  • key-wallet/src/transaction_checking/wallet_checker.rs
key-wallet/**/transaction_checking/**/*.rs

📄 CodeRabbit inference engine (key-wallet/CLAUDE.md)

Implement transaction classification and routing through TransactionRouter to avoid checking all accounts for every transaction

Files:

  • key-wallet/src/transaction_checking/wallet_checker.rs
🧠 Learnings (31)
📓 Common learnings
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/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory
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/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues
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/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together
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 `BTreeMap` for ordered data (accounts, transactions) and `HashMap` for lookups (address mappings); apply memory management strategies for old transaction data
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/**/transaction_checking/**/*.rs : Implement transaction classification and routing through `TransactionRouter` to avoid checking all accounts for every transaction
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.
📚 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:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.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/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.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 `BTreeMap` for ordered data (accounts, transactions) and `HashMap` for lookups (address mappings); apply memory management strategies for old transaction data

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.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/**/address_pool/**/*.rs : Support multiple `KeySource` variants (Private, Public, NoKeySource) to enable both full wallets and watch-only wallets with the same interface

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Implement sequential phase-based synchronization via SyncManager with phases progressing in order: Headers → Masternode List → Filter Headers → Filters → Blocks

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
📚 Learning: 2025-12-22T17:59:37.849Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-22T17:59:37.849Z
Learning: Applies to **/{dash-network,dash-spv,key-wallet}/**/*.rs : Use async/await for async operations in network and wallet modules

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet-manager/src/wallet_manager/process_block.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:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use Tokio channels for inter-component message passing between async tasks

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Organize tests into unit tests (in-module), integration tests (tests/ directory), real network tests (with live Dash Core nodes), and performance benchmarks

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Integration tests should gracefully handle unavailable Dash Core nodes at 127.0.0.1:9999 without failing the test suite

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_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:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: Cover critical parsing, networking, SPV, and wallet flows in tests; add regression tests for fixes; consider property tests with `proptest`

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.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/**/tests/**/*.rs : Organize unit tests by functionality: separate test files for BIP32, mnemonics, addresses, derivation paths, and PSBT operations

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: Applies to **/tests/**/*.rs : Use descriptive test names (e.g., `test_parse_address_mainnet`)

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/validation/**/*.rs : Implement three validation modes: ValidationMode::None (no validation), ValidationMode::Basic (structure and timestamp validation), and ValidationMode::Full (complete PoW and chain validation)

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/client/**/*.rs : Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor_test.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:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.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/**/transaction_checking/**/*.rs : Implement transaction classification and routing through `TransactionRouter` to avoid checking all accounts for every transaction

Applied to files:

  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.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 : Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations

Applied to files:

  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet-manager/src/wallet_manager/mod.rs
📚 Learning: 2025-06-26T15:47:37.438Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:47:37.438Z
Learning: Transaction IDs (txids) and block hashes in Dash are always 32 bytes and should be passed as fixed-size byte arrays in FFI interfaces, not as C strings, to avoid inefficiency and encoding issues.

Applied to files:

  • dash-spv/src/client/block_processor.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase, built on tokio runtime

Applied to files:

  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/error.rs : Use domain-specific error types (NetworkError, StorageError, SyncError, ValidationError, SpvError) rather than generic error handling

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use Arc<dyn TraitName> for trait objects to enable runtime polymorphism for NetworkManager and StorageManager

Applied to files:

  • dash-spv/src/client/block_processor_test.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/network/**/*.rs : Implement configurable timeouts with recovery mechanisms for network operations

Applied to files:

  • dash-spv/src/client/block_processor_test.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/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues

Applied to files:

  • key-wallet/src/transaction_checking/wallet_checker.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/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory

Applied to files:

  • key-wallet/src/transaction_checking/wallet_checker.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/**/address_pool/**/*.rs : Pre-generate addresses in batches (typically 20-100) and store them in pools; only derive on-demand when the pool is exhausted

Applied to files:

  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet/src/transaction_checking/wallet_checker.rs
🧬 Code graph analysis (3)
key-wallet-manager/tests/spv_integration_tests.rs (2)
test-utils/src/builders.rs (3)
  • create_transaction_to_address (164-169)
  • new (36-38)
  • new (111-113)
dash-spv/tests/block_download_test.rs (1)
  • create_test_block (139-153)
dash-spv/src/client/block_processor_test.rs (2)
key-wallet-manager/src/wallet_interface.rs (1)
  • process_block (27-31)
key-wallet-manager/src/wallet_manager/process_block.rs (1)
  • process_block (16-45)
key-wallet/src/transaction_checking/wallet_checker.rs (1)
key-wallet/src/transaction_checking/account_checker.rs (1)
  • account_index (180-212)
⏰ 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). (20)
  • GitHub Check: fuzz (hashes_sha1)
  • GitHub Check: fuzz (hashes_ripemd160)
  • GitHub Check: fuzz (hashes_sha512_256)
  • GitHub Check: fuzz (hashes_sha256)
  • GitHub Check: fuzz (hashes_cbor)
  • GitHub Check: fuzz (hashes_sha512)
  • GitHub Check: fuzz (hashes_json)
  • GitHub Check: fuzz (dash_deserialize_script)
  • GitHub Check: fuzz (dash_deserialize_block)
  • GitHub Check: fuzz (dash_outpoint_string)
  • GitHub Check: fuzz (dash_deserialize_amount)
  • GitHub Check: fuzz (dash_script_bytes_to_asm_fmt)
  • GitHub Check: fuzz (dash_deserialize_address)
  • GitHub Check: fuzz (dash_deser_net_msg)
  • GitHub Check: RPC Tests (stable, true)
  • GitHub Check: Key Wallet Components Tests
  • GitHub Check: SPV Components Tests
  • GitHub Check: Core Components Tests
  • GitHub Check: Pre-commit (macos-latest)
  • GitHub Check: Pre-commit (ubuntu-latest)
🔇 Additional comments (9)
key-wallet-manager/src/wallet_manager/mod.rs (3)

52-59: LGTM! Well-structured result type.

The CheckTransactionsResult struct clearly separates the affected wallets from newly generated addresses, making the return value self-documenting. The Default derive enables clean initialization.


462-469: All call sites of check_transaction_in_all_wallets have been properly updated to handle the CheckTransactionsResult return type. The breaking change from Vec<WalletId> has been fully implemented:

  • key-wallet-ffi/src/wallet_manager.rs:771 accesses result.affected_wallets
  • key-wallet-manager/src/wallet_manager/process_block.rs:33 accesses both check_result.affected_wallets and check_result.new_addresses
  • key-wallet-manager/src/wallet_manager/process_block.rs:51 awaits the result (intentionally unused for mempool transactions)

482-491: No action required — return type is correct.

The WalletTransactionChecker::check_transaction method returns TransactionCheckResult, which includes both required fields: is_relevant (bool) and new_addresses (Vec

). The code correctly accesses these fields at lines 486 and 491. Collecting new addresses outside the relevance check is correct behavior for gap limit maintenance.

key-wallet/src/transaction_checking/wallet_checker.rs (1)

78-78: LGTM: Clean integration of new address capture with proper error handling.

The mutation of result and the error-handling pattern for maintain_gap_limit are well-implemented:

  • Successfully generated addresses are accumulated in result.new_addresses
  • Errors are logged with full context (account index, pool type, error message) per the previous review feedback
  • Processing continues if one pool fails, allowing other pools to succeed

This aligns with the PR's goal of capturing new addresses from gap-limit maintenance for downstream rescanning.

Also applies to: 284-320

key-wallet-manager/src/wallet_interface.rs (1)

12-31: LGTM: Well-designed API evolution.

The introduction of BlockProcessingResult follows good API design patterns:

  • Structured result type allows future expansion without breaking changes
  • Clear documentation of both fields
  • Appropriate derives (Debug, Default, Clone) for a result type
  • Public fields are correct for this pattern
key-wallet-manager/tests/spv_integration_tests.rs (1)

121-133: LGTM: Comprehensive validation of new address generation.

The test properly verifies:

  • Relevant transaction detection (2 out of 3 transactions)
  • New address generation count
  • New addresses appear in the monitored set
  • Monitored set growth matches new address count
key-wallet-manager/src/wallet_manager/process_block.rs (1)

16-45: LGTM: Correct accumulation of block processing results.

The implementation properly accumulates both fields:

  • relevant_txids are collected only when affected_wallets is non-empty (line 35-36)
  • new_addresses are accumulated for every transaction (line 39), which is correct since gap-limit maintenance can occur during any transaction's processing, regardless of relevance

The refactoring cleanly integrates the new structured result without changing the core processing logic.

dash-spv/src/client/block_processor_test.rs (1)

44-53: LGTM: Test mocks properly updated for new interface.

Both mock implementations correctly return BlockProcessingResult:

  • MockWallet returns all transaction IDs as relevant with empty new_addresses (reasonable test simplification)
  • NonMatchingWallet uses BlockProcessingResult::default() for empty results

Also applies to: 255-261

dash-spv/src/client/block_processor.rs (1)

225-275: LGTM: Consistent usage of BlockProcessingResult throughout.

All references properly use result.relevant_txids:

  • Checking if empty (line 226)
  • Logging count (line 229)
  • Iterating for event emission (line 241)
  • Reporting in BlockProcessed event (line 274)

The new_addresses field is not used here, which aligns with the PR description stating it's for a subsequent PR to implement rescanning.

@xdustinface xdustinface changed the base branch from v0.41-dev to v0.42-dev December 30, 2025 22:35
@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Jan 2, 2026
@github-actions
Copy link

github-actions bot commented Jan 2, 2026

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

@xdustinface xdustinface force-pushed the feat/capture-new-addresses branch from 46fc77a to 2b96afc Compare January 2, 2026 16:16
@github-actions github-actions bot removed the merge-conflict The PR conflicts with the target branch. label Jan 2, 2026
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

🧹 Nitpick comments (3)
key-wallet/src/transaction_checking/wallet_checker.rs (1)

312-313: Minor: Logging format differs between pool types.

For Standard accounts, pool_type uses string literals ("external", "internal"), while generic pools use debug format (?pool.pool_type). This is functionally fine, but consider using a consistent format for log aggregation purposes:

 pool_type = ?pool.pool_type,

or

 pool_type = %pool.pool_type,

This is a minor observation and not blocking.

dash-spv/src/client/block_processor.rs (1)

268-273: Note: result.new_addresses is not used yet.

The new_addresses field from BlockProcessingResult is populated but not consumed in this block processor. Per the PR description, this is intentional as a subsequent PR will use these addresses for rescanning during synchronization.

Consider adding a brief comment or TODO to document this future integration point:

+        // TODO: Use result.new_addresses for rescanning in subsequent PR
         // Emit BlockProcessed event with actual relevant transaction count
key-wallet-manager/tests/spv_integration_tests.rs (1)

106-109: This pattern is used consistently throughout the codebase as an intentional test placeholder.

The [0x02; 33] public key pattern is intentionally used as a dummy/placeholder key in multiple test files in the codebase (wallet_checker.rs, routing.rs, provider.rs, and spv_integration_tests.rs). The tests work correctly with this pattern—the key serves its purpose by creating an address that does not match any monitored wallet addresses, which is what the test verifies (line 124: assert!(!result.relevant_txids.contains(&tx3.txid()))).

While using a mathematically valid test public key (e.g., the generator point G) would be a code quality improvement, the current pattern is functional and idiomatic within this codebase. No changes are required.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46fc77a and 2b96afc.

📒 Files selected for processing (13)
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/sync/message_handlers.rs
  • key-wallet-ffi/src/wallet_manager.rs
  • key-wallet-manager/Cargo.toml
  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • test-utils/src/builders.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • key-wallet-ffi/src/wallet_manager.rs
  • dash-spv/src/client/block_processor_test.rs
  • key-wallet-manager/Cargo.toml
  • dash-spv/src/sync/message_handlers.rs
🧰 Additional context used
📓 Path-based instructions (8)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: MSRV (Minimum Supported Rust Version) is 1.89; ensure compatibility with this version for all builds
Unit tests should live alongside code with #[cfg(test)] annotation; integration tests use the tests/ directory
Use snake_case for function and variable names
Use UpperCamelCase for types and traits
Use SCREAMING_SNAKE_CASE for constants
Format code with rustfmt before commits; ensure cargo fmt --all is run
Run cargo clippy --workspace --all-targets -- -D warnings for linting; avoid warnings in CI
Prefer async/await via tokio for asynchronous operations

**/*.rs: Never hardcode network parameters, addresses, or keys in Rust code
Use proper error types (thiserror) and propagate errors appropriately in Rust
Use tokio runtime for async operations in Rust
Use conditional compilation with feature flags for optional features
Write unit tests for new functionality in Rust
Format code using cargo fmt
Run clippy with all features and all targets, treating warnings as errors
Never log or expose private keys in any code
Always validate inputs from untrusted sources in Rust
Use secure random number generation for keys

Files:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • test-utils/src/builders.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
**/tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/tests/**/*.rs: Use descriptive test names (e.g., test_parse_address_mainnet)
Mark network-dependent or long-running tests with #[ignore] and run with -- --ignored

Files:

  • key-wallet-manager/tests/spv_integration_tests.rs
**/*integration*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Write integration tests for network operations

Files:

  • key-wallet-manager/tests/spv_integration_tests.rs
**/*test*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*test*.rs: Test both mainnet and testnet configurations
Use proptest for property-based testing where appropriate

Files:

  • key-wallet-manager/tests/spv_integration_tests.rs
dash-spv/**/*.rs

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

dash-spv/**/*.rs: Use async/await throughout the codebase, built on tokio runtime
Use Arc for trait objects to enable runtime polymorphism for NetworkManager and StorageManager
Use Tokio channels for inter-component message passing between async tasks
Maintain minimum Rust version (MSRV) of 1.89 and use only compatible syntax and features

Files:

  • dash-spv/src/client/block_processor.rs
dash-spv/src/client/**/*.rs

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

Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization

Files:

  • dash-spv/src/client/block_processor.rs
key-wallet/**/*.rs

📄 CodeRabbit inference engine (key-wallet/CLAUDE.md)

key-wallet/**/*.rs: Separate immutable structures (Account, Wallet) containing only identity information from mutable wrappers (ManagedAccount, ManagedWalletInfo) with state management
Never serialize or log private keys in production; use public keys or key fingerprints for identification instead
Always validate network consistency when deriving or validating addresses; never mix mainnet and testnet operations
Use BTreeMap for ordered data (accounts, transactions) and HashMap for lookups (address mappings); apply memory management strategies for old transaction data
Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations
Use the ? operator for error propagation, provide context in error messages, never panic in library code, and return Result<T> for all fallible operations

Files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
key-wallet/**/transaction_checking/**/*.rs

📄 CodeRabbit inference engine (key-wallet/CLAUDE.md)

Implement transaction classification and routing through TransactionRouter to avoid checking all accounts for every transaction

Files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
🧠 Learnings (27)
📓 Common learnings
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/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory
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/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues
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/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together
📚 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/**/address_pool/**/*.rs : Support multiple `KeySource` variants (Private, Public, NoKeySource) to enable both full wallets and watch-only wallets with the same interface

Applied to files:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.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 `BTreeMap` for ordered data (accounts, transactions) and `HashMap` for lookups (address mappings); apply memory management strategies for old transaction data

Applied to files:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet/src/transaction_checking/wallet_checker.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/**/managed_account/**/*.rs : Implement atomic state updates when processing transactions: update transactions, UTXOs, balances, and address usage state together

Applied to files:

  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet/src/transaction_checking/wallet_checker.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/**/transaction_checking/**/*.rs : Implement transaction classification and routing through `TransactionRouter` to avoid checking all accounts for every transaction

Applied to files:

  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet-manager/src/wallet_manager/process_block.rs
  • key-wallet/src/transaction_checking/wallet_checker.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 : Apply atomic state updates when managing watch-only wallets: validate that external signatures match expected pubkeys and never attempt signing operations

Applied to files:

  • key-wallet-manager/src/wallet_manager/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/sync/**/*.rs : Implement sequential phase-based synchronization via SyncManager with phases progressing in order: Headers → Masternode List → Filter Headers → Filters → Blocks

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor.rs
  • key-wallet-manager/src/wallet_manager/process_block.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:

  • key-wallet-manager/src/wallet_interface.rs
  • key-wallet-manager/tests/spv_integration_tests.rs
  • dash-spv/src/client/block_processor.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use Tokio channels for inter-component message passing between async tasks

Applied to files:

  • key-wallet-manager/src/wallet_interface.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Organize tests into unit tests (in-module), integration tests (tests/ directory), real network tests (with live Dash Core nodes), and performance benchmarks

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: Cover critical parsing, networking, SPV, and wallet flows in tests; add regression tests for fixes; consider property tests with `proptest`

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.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/**/tests/**/*.rs : Organize unit tests by functionality: separate test files for BIP32, mnemonics, addresses, derivation paths, and PSBT operations

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/tests/**/*.rs : Integration tests should gracefully handle unavailable Dash Core nodes at 127.0.0.1:9999 without failing the test suite

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.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:

  • key-wallet-manager/tests/spv_integration_tests.rs
📚 Learning: 2025-12-22T17:59:51.097Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-22T17:59:51.097Z
Learning: Applies to **/tests/**/*.rs : Use descriptive test names (e.g., `test_parse_address_mainnet`)

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/validation/**/*.rs : Implement three validation modes: ValidationMode::None (no validation), ValidationMode::Basic (structure and timestamp validation), and ValidationMode::Full (complete PoW and chain validation)

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/src/client/**/*.rs : Use the DashSpvClient high-level API with proper configuration via ClientConfig for client initialization

Applied to files:

  • key-wallet-manager/tests/spv_integration_tests.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:

  • key-wallet-manager/tests/spv_integration_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
📚 Learning: 2025-06-26T15:47:37.438Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T15:47:37.438Z
Learning: Transaction IDs (txids) and block hashes in Dash are always 32 bytes and should be passed as fixed-size byte arrays in FFI interfaces, not as C strings, to avoid inefficiency and encoding issues.

Applied to files:

  • dash-spv/src/client/block_processor.rs
📚 Learning: 2025-12-16T09:03:55.811Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv/CLAUDE.md:0-0
Timestamp: 2025-12-16T09:03:55.811Z
Learning: Applies to dash-spv/**/*.rs : Use async/await throughout the codebase, built on tokio runtime

Applied to files:

  • dash-spv/src/client/block_processor.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/**/address_pool/**/*.rs : Generate addresses in batches using gap limit and staged generation instead of unbounded address generation to prevent memory and performance issues

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.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/**/address_pool/**/*.rs : Use staged gap limit management with `GapLimitStage` tracking `last_used_index` and `used_indices` to enable efficient address discovery without loading entire chains into memory

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.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/**/address_pool/**/*.rs : Pre-generate addresses in batches (typically 20-100) and store them in pools; only derive on-demand when the pool is exhausted

Applied to files:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/wallet_checker.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:

  • key-wallet/src/transaction_checking/wallet_checker.rs
🧬 Code graph analysis (5)
key-wallet-manager/src/wallet_manager/mod.rs (2)
key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs (2)
  • wallet_id (35-35)
  • wallet_id (134-136)
key-wallet/src/wallet/mod.rs (1)
  • wallet_id (116-116)
key-wallet-manager/tests/spv_integration_tests.rs (2)
key-wallet/src/transaction_checking/wallet_checker.rs (1)
  • create_transaction_to_address (433-452)
test-utils/src/builders.rs (3)
  • create_transaction_to_address (164-169)
  • new (36-38)
  • new (111-113)
dash-spv/src/client/block_processor.rs (3)
dash-spv/src/client/core.rs (1)
  • wallet (153-155)
dash-spv/src/types.rs (1)
  • txid (985-987)
dash/src/blockdata/transaction/mod.rs (1)
  • txid (199-214)
key-wallet-manager/src/wallet_manager/process_block.rs (1)
key-wallet-manager/src/wallet_interface.rs (1)
  • process_block (27-31)
key-wallet/src/transaction_checking/wallet_checker.rs (1)
key-wallet/src/transaction_checking/account_checker.rs (1)
  • account_index (180-212)
⏰ 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). (20)
  • GitHub Check: fuzz (dash_deserialize_script)
  • GitHub Check: fuzz (hashes_cbor)
  • GitHub Check: fuzz (hashes_sha512_256)
  • GitHub Check: fuzz (dash_deserialize_amount)
  • GitHub Check: fuzz (dash_outpoint_string)
  • GitHub Check: fuzz (dash_script_bytes_to_asm_fmt)
  • GitHub Check: fuzz (dash_deser_net_msg)
  • GitHub Check: fuzz (hashes_sha256)
  • GitHub Check: fuzz (hashes_sha512)
  • GitHub Check: fuzz (hashes_sha1)
  • GitHub Check: fuzz (hashes_json)
  • GitHub Check: fuzz (dash_deserialize_block)
  • GitHub Check: fuzz (hashes_ripemd160)
  • GitHub Check: fuzz (dash_deserialize_witness)
  • GitHub Check: fuzz (dash_deserialize_address)
  • GitHub Check: Pre-commit (ubuntu-latest)
  • GitHub Check: RPC Tests (stable, true)
  • GitHub Check: Core Components Tests
  • GitHub Check: SPV Components Tests
  • GitHub Check: Pre-commit (macos-latest)
🔇 Additional comments (14)
key-wallet-manager/src/wallet_manager/mod.rs (2)

52-59: LGTM! Well-structured result type.

The CheckTransactionsResult struct provides a clear composite result that aligns with the broader BlockProcessingResult pattern introduced in this PR. The use of Default simplifies initialization.


462-496: LGTM! Properly aggregates results from all wallets.

The function correctly accumulates both affected_wallets and new_addresses from each wallet's transaction check. The logic properly extends result.new_addresses with per-wallet results that are populated by the check_transaction method in wallet_checker.rs when it calls maintain_gap_limit() on address pools during state updates.

key-wallet-manager/src/lib.rs (1)

43-43: LGTM! Proper public API exposure.

The re-export of BlockProcessingResult makes it conveniently accessible to external consumers through the crate root, consistent with other public types.

test-utils/src/builders.rs (1)

164-169: LGTM! Useful test helper.

The create_transaction_to_address helper provides a convenient way to construct test transactions directed to specific addresses. The implementation is straightforward and appropriate for testing scenarios.

key-wallet-manager/src/wallet_interface.rs (2)

12-19: LGTM! Well-documented result structure.

The BlockProcessingResult struct provides a clear composite result for block processing. The documentation appropriately describes both fields.


24-31: Breaking API change has been properly migrated across all call sites.

The return type change from Vec<Txid> to BlockProcessingResult is confirmed. All implementations and call sites have been correctly updated to use result.relevant_txids instead of accessing a vector directly. The new structure also appropriately includes new_addresses for gap limit maintenance information.

key-wallet/src/transaction_checking/account_checker.rs (1)

41-42: Field is properly populated via maintain_gap_limit calls.

The new_addresses field in TransactionCheckResult is initialized as Vec::new() at line 289 in account_checker.rs, and it is populated in wallet_checker.rs where maintain_gap_limit is called on address pools. The results are extended into the field at lines 285, 296, and 309 respectively:

Ok(new_addrs) => result.new_addresses.extend(new_addrs)

This occurs for both standard BIP44 accounts (external and internal address pools) and other account types. The implementation is complete.

Likely an incorrect or invalid review comment.

key-wallet-manager/tests/spv_integration_tests.rs (2)

104-134: Well-structured test for BlockProcessingResult verification.

The test properly validates:

  • relevant_txids contains only wallet-relevant transactions (tx1, tx2)
  • new_addresses count matches the actual increase in monitored addresses
  • New addresses are correctly included in the updated monitored set

The approach of capturing addresses_before and comparing with addresses_after ensures the gap-limit maintenance is working correctly.


136-155: Good negative test case for external-only transactions.

This test correctly validates that when transactions only target external addresses (not monitored by the wallet), the BlockProcessingResult returns empty relevant_txids and new_addresses.

key-wallet/src/transaction_checking/wallet_checker.rs (2)

78-78: Good: Result is now mutable to accumulate new addresses.

Making result mutable enables the accumulation of new_addresses from gap limit maintenance across all address pools.


284-319: Proper error handling with structured logging for gap limit maintenance.

The implementation correctly:

  1. Logs errors with account index, pool type, and error details for debugging
  2. Continues processing after errors (per earlier discussion)
  3. Accumulates successful new addresses into result.new_addresses

The structured logging with tracing::error! and named fields (account_index, pool_type, error) aligns well with observability best practices.

key-wallet-manager/src/wallet_manager/process_block.rs (2)

16-44: Clean refactor to return BlockProcessingResult.

The implementation correctly:

  1. Initializes BlockProcessingResult::default() for accumulation
  2. Pushes to result.relevant_txids when check_result.affected_wallets is non-empty
  3. Extends result.new_addresses with newly generated addresses from each transaction check
  4. Returns the complete result

This aligns with the PR objective to capture new addresses from gap-limit maintenance.


33-39: [No action needed; the code is correct.]

The struct CheckTransactionsResult in key-wallet-manager/src/wallet_manager/mod.rs (lines 54-56) correctly defines the field as pub affected_wallets: Vec<WalletId>, which matches the usage in process_block.rs line 35. The review comment conflated this with TransactionCheckResult from account_checker.rs, which is a different struct in a different module.

Likely an incorrect or invalid review comment.

dash-spv/src/client/block_processor.rs (1)

223-264: Correctly adapted to BlockProcessingResult.

The block processor properly:

  1. Receives BlockProcessingResult from wallet.process_block()
  2. Uses result.relevant_txids.is_empty() for the relevance check
  3. Iterates over &result.relevant_txids for transaction detection events
  4. Passes result.relevant_txids.len() to the BlockProcessed event

The integration maintains the existing logging and event emission patterns while adapting to the new return type.

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