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 produce richer result objects that include counts of relevant transactions and any newly discovered addresses.
  • Tests

    • Integration and unit tests expanded to cover multi-transaction blocks, address monitoring growth, and empty-result scenarios.
    • New test helper added to create transactions to a given address.
  • Chores

    • Small dev-test dependency added 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

Warning

Rate limit exceeded

@xdustinface has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

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

📒 Files selected for processing (1)
  • key-wallet/src/transaction_checking/wallet_checker.rs (2 hunks)

Walkthrough

The PR replaces many raw Vec return types with structured result types: BlockProcessingResult (with relevant_txids and new_addresses) for block processing and CheckTransactionsResult (with affected_wallets and new_addresses) for transaction checks; call sites and tests updated accordingly.

Changes

Cohort / File(s) Summary
Result Type Definitions
key-wallet-manager/src/wallet_interface.rs
Added public BlockProcessingResult { pub relevant_txids: Vec<Txid>, pub new_addresses: Vec<Address> }; changed WalletInterface::process_block return type to BlockProcessingResult
key-wallet-manager/src/wallet_manager/mod.rs
key-wallet-manager/src/lib.rs
WalletInterface Implementations / Call Sites
key-wallet-manager/src/wallet_manager/process_block.rs
Updated implementation to build/return BlockProcessingResult; accumulate relevant_txids and new_addresses into the result
dash-spv/src/client/block_processor.rs
dash-spv/src/sync/message_handlers.rs
Transaction Checking Changes
key-wallet/src/transaction_checking/account_checker.rs
Added pub new_addresses: Vec<Address> to TransactionCheckResult and initialized it in check_transaction
key-wallet/src/transaction_checking/wallet_checker.rs
Tests & Test Utilities
dash-spv/src/client/block_processor_test.rs
Updated mocks and tests to return BlockProcessingResult (imported) instead of Vec<Txid>; adjusted expectations
key-wallet-manager/tests/spv_integration_tests.rs
test-utils/src/builders.rs
Configuration & FFI
key-wallet-manager/Cargo.toml
Added dashcore-test-utils as a dev-dependency pointing to ../test-utils
key-wallet-ffi/src/wallet_manager.rs

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to correctness and naming of BlockProcessingResult and CheckTransactionsResult fields and visibility.
  • Verify all call sites consistently use .relevant_txids, .affected_wallets, and .new_addresses.
  • Review gap-limit maintenance paths in wallet_checker.rs to ensure new_addresses is populated and propagated.
  • Run/inspect updated integration tests that rely on new test helper create_transaction_to_address.

Poem

🐰 I hopped through code with eager paws,

I wrapped txids in tidy laws,
New addresses snug in a row,
Results now carry what wallets know,
Hop—structured data steals the show!

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 clearly and accurately summarizes the main change: introducing logic to capture new addresses from maintain_gap_limit and expose them through BlockProcessingResult.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

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