Skip to content

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Jan 11, 2026

Blocks are already processed in the downloading blocks sync phase. And even though it anyway doesn't work properly in the current sync implementation this block processor adds a another layer of redundant block processing. Which to be fair might be a bid of a band aid if we request blocks while we are still downloading filters but thats imo not how its intended to work and im coming up with a sync rewrite PR soon which will leave this behind anyway.

Summary by CodeRabbit

Release Notes

  • Removed Features

    • Removed block processor subsystem from Dash SPV client, including background task processing and internal messaging infrastructure for block and transaction handling
  • Tests

    • Removed associated block processor test suite
  • Documentation

    • Updated architecture documentation to reflect removal of block processor module

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

📝 Walkthrough

Walkthrough

The PR removes the entire block processing subsystem from the Dash SPV client, including the BlockProcessor worker, BlockProcessingTask enum, and all associated block processing orchestration logic that handled block, transaction, and compact filter task queuing across multiple components.

Changes

Cohort / File(s) Change Summary
Block Processor Removal
dash-spv/src/client/block_processor.rs, dash-spv/src/client/block_processor_test.rs
Deleted entire BlockProcessor struct, BlockProcessingTask enum, worker loop (run method), internal helpers (process_block_internal, process_transaction_internal, update_chain_state_with_block), and all associated unit tests. Eliminates 643 lines of core logic and 575 lines of test coverage.
Module Exports
dash-spv/src/client/mod.rs
Removed public module exposure and re-exports: pub mod block_processor and pub use block_processor::{BlockProcessingTask, BlockProcessor}. Removed test module reference.
Client State
dash-spv/src/client/core.rs
Removed block_processor_tx field from DashSpvClient struct and associated BlockProcessingTask import.
Initialization
dash-spv/src/client/lifecycle.rs
Removed BlockProcessor import, removed block_processor_tx field initialization, and deleted BlockProcessor worker spawning during client startup.
Message Routing
dash-spv/src/client/message_handler.rs, dash-spv/src/client/message_handler_test.rs
Removed block_processor_tx field from MessageHandler, eliminated constructor parameter, removed process_new_block method, deleted compact filter and block forwarding logic, and updated test cases to remove block processor references.
Sync Coordination
dash-spv/src/client/sync_coordinator.rs
Removed process_new_block method from DashSpvClient impl, removed BlockProcessingTask import, and updated MessageHandler initialization to no longer pass block processor channel.
Documentation & Tests
dash-spv/ARCHITECTURE.md, dash-spv/TEST_SUMMARY.md, dash-spv/tests/transaction_calculation_test.rs
Updated architecture documentation to remove block_processor.rs references, removed block_processor_test.rs from test summary, and updated comment in transaction calculation test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Poem

🐰 The block processor fades away,
No more tasks to queue and sway,
Simpler flows, a cleaner way,
The SPV client hops to stay! 🐇

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'chore: drop redundant block processing' clearly and concisely summarizes the main change: removing the block processor subsystem that duplicates existing block processing logic during the sync phase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 xdustinface marked this pull request as ready for review January 12, 2026 00:17
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)
dash-spv/src/client/message_handler_test.rs (1)

1-8: Tests disabled pending architecture rewrite.

The entire test module is commented out. While the import on line 8 correctly removes BlockProcessingTask, consider tracking the re-enablement of these tests with a TODO issue to ensure they don't remain disabled indefinitely after the planned sync rewrite.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a01febe and 796fec2.

📒 Files selected for processing (11)
  • TEST_SUMMARY.md
  • dash-spv/ARCHITECTURE.md
  • dash-spv/src/client/block_processor.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/src/client/core.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/mod.rs
  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/tests/transaction_calculation_test.rs
💤 Files with no reviewable changes (6)
  • dash-spv/src/client/mod.rs
  • TEST_SUMMARY.md
  • dash-spv/src/client/message_handler.rs
  • dash-spv/src/client/block_processor_test.rs
  • dash-spv/ARCHITECTURE.md
  • dash-spv/src/client/block_processor.rs
🧰 Additional context used
📓 Path-based instructions (6)
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/sync_coordinator.rs
  • dash-spv/tests/transaction_calculation_test.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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/sync_coordinator.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.rs
**/*.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:

  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/tests/transaction_calculation_test.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.rs
dash-spv/tests/**/*.rs

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

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
Integration tests should gracefully handle unavailable Dash Core nodes at 127.0.0.1:9999 without failing the test suite

Files:

  • dash-spv/tests/transaction_calculation_test.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:

  • dash-spv/tests/transaction_calculation_test.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:

  • dash-spv/tests/transaction_calculation_test.rs
  • dash-spv/src/client/message_handler_test.rs
🧠 Learnings (24)
📓 Common learnings
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-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:

  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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/sync_coordinator.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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/sync_coordinator.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.rs
📚 Learning: 2025-06-26T16:01:37.609Z
Learnt from: DCG-Claude
Repo: dashpay/rust-dashcore PR: 0
File: :0-0
Timestamp: 2025-06-26T16:01:37.609Z
Learning: The mempool tracking infrastructure (UnconfirmedTransaction, MempoolState, configuration, and mempool_filter.rs) is fully implemented and integrated in the Dash SPV client as of this PR, including client logic, FFI APIs, and tests.

Applied to files:

  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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/sync_coordinator.rs
  • dash-spv/src/client/core.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/sync_coordinator.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:

  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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: Follow a layered, trait-based architecture with clear separation of concerns across modules: client/, network/, storage/, sync/, validation/, wallet/, with trait-based abstractions for swappable implementations

Applied to files:

  • dash-spv/src/client/sync_coordinator.rs
  • dash-spv/src/client/core.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/sync_coordinator.rs
  • dash-spv/src/client/core.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:

  • dash-spv/tests/transaction_calculation_test.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/tests/unit/**/*.rs : Add corresponding unit tests in `tests/unit/` for each new FFI function

Applied to files:

  • dash-spv/tests/transaction_calculation_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:

  • dash-spv/tests/transaction_calculation_test.rs
  • dash-spv/src/client/message_handler_test.rs
  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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:

  • dash-spv/tests/transaction_calculation_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:

  • dash-spv/src/client/message_handler_test.rs
📚 Learning: 2025-12-30T22:00:57.000Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T22:00:57.000Z
Learning: Applies to **/*integration*.rs : Write integration tests for network operations

Applied to files:

  • dash-spv/src/client/message_handler_test.rs
📚 Learning: 2025-12-30T22:00:57.000Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T22:00:57.000Z
Learning: Applies to **/*test*.rs : Test both mainnet and testnet configurations

Applied to files:

  • dash-spv/src/client/message_handler_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:

  • dash-spv/src/client/message_handler_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 : Use DNS-first peer discovery with automatic DNS seeds (dnsseed.dash.org, testnet-seed.dashdot.io) when no explicit peers are configured; implement immediate startup with 10-second delay only for subsequent peer searches

Applied to files:

  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.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 : Maintain minimum Rust version (MSRV) of 1.89 and use only compatible syntax and features

Applied to files:

  • dash-spv/src/client/lifecycle.rs
  • dash-spv/src/client/core.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Use thread-local storage for error propagation via `dash_spv_ffi_get_last_error()` function

Applied to files:

  • dash-spv/src/client/lifecycle.rs
📚 Learning: 2025-12-01T07:59:58.608Z
Learnt from: CR
Repo: dashpay/rust-dashcore PR: 0
File: dash-spv-ffi/CLAUDE.md:0-0
Timestamp: 2025-12-01T07:59:58.608Z
Learning: Applies to dash-spv-ffi/src/**/*.rs : Rust strings must be returned as `*const c_char` with caller responsibility to free using `dash_string_free`

Applied to files:

  • dash-spv/src/client/core.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/storage/**/*.rs : Store headers in 10,000-header segments with index files in headers/ directory, filter headers and compact block filters in filters/ directory, and state in state/ directory

Applied to files:

  • dash-spv/src/client/core.rs
📚 Learning: 2025-11-27T10:30:54.015Z
Learnt from: xdustinface
Repo: dashpay/rust-dashcore PR: 214
File: dash-spv/examples/filter_sync.rs:48-51
Timestamp: 2025-11-27T10:30:54.015Z
Learning: The DashSpvClient::run method in dash-spv internally handles Ctrl-C shutdown by spawning a task that listens for tokio::signal::ctrl_c() and cancels the provided CancellationToken. Examples and callers should create a CancellationToken without explicitly cancelling it, as the cancellation is managed internally by the run method.

Applied to files:

  • dash-spv/src/client/core.rs
🔇 Additional comments (5)
dash-spv/tests/transaction_calculation_test.rs (1)

35-35: LGTM!

Comment correctly updated to remove the now-deleted block_processor.rs reference, consistent with the PR's removal of the block processing subsystem.

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

27-27: LGTM!

Import correctly updated to remove BlockProcessingTask which is no longer exposed from the module. The struct definition below properly excludes the removed block_processor_tx field.

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

26-26: LGTM!

Import correctly updated to remove BlockProcessor. The constructor below properly excludes creating the block_processor_tx channel and spawning the BlockProcessor worker, aligning with the PR's intent to rely on inline block processing during sync phases.

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

14-14: LGTM!

Import correctly updated to remove BlockProcessingTask. The change aligns with the removal of the background block processor channel throughout the codebase.


601-609: LGTM!

MessageHandler::new() constructor call correctly updated to exclude the removed block_processor_tx parameter. The handler retains all other necessary dependencies for network message processing.

Copy link
Collaborator

@ZocoLini ZocoLini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to merge this

@xdustinface xdustinface merged commit 3de3118 into v0.42-dev Jan 12, 2026
53 checks passed
@xdustinface xdustinface deleted the chore/drop-block-processor branch January 12, 2026 22:37
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.

3 participants