Skip to content

Comments

refactor: remove SyncState::Initializing variant#465

Open
xdustinface wants to merge 1 commit intov0.42-devfrom
refactor/drop-initializing-state
Open

refactor: remove SyncState::Initializing variant#465
xdustinface wants to merge 1 commit intov0.42-devfrom
refactor/drop-initializing-state

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Feb 21, 2026

The Initializing state was only used as a default before initialize() was called. Replace it with WaitForEvents as the default state to simplify the state machine.

Summary by CodeRabbit

  • Refactor

    • Reorganized synchronization state ordering and values for consistency across the codebase.
  • Tests

    • Updated test expectations to reflect changes to synchronization state handling.

The `Initializing` state was only used as a default before
`initialize()` was called. Replace it with `WaitForEvents` as the
default state to simplify the state machine.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

The changes remove the Initializing sync state variant and promote WaitForEvents as the new default synchronization state across the codebase. Enum variant order is reordered in both FFI and core modules, with corresponding updates to type conversions, match statements, and test assertions throughout all synchronization managers.

Changes

Cohort / File(s) Summary
FFI Type Definitions
dash-spv-ffi/include/dash_spv_ffi.h, dash-spv-ffi/src/types.rs
Removed Initializing variant from FFISyncState enum; reordered WaitForEvents (now 1) and WaitingForConnections (now 2). Updated From<SyncState> impl to remove Initializing mapping.
FFI Implementation
dash-spv-ffi/src/bin/ffi_cli.rs
Updated on_progress_update state-to-string match statement to handle new enum variant order and remove Initializing arm.
FFI Tests
dash-spv-ffi/tests/test_types.rs
Updated test expectations to use WaitForEvents instead of Initializing for progress state assertions.
Core Sync State Definition
dash-spv/src/sync/progress.rs
Removed Initializing enum variant; made WaitForEvents the new default state. Updated state computation logic to return WaitForEvents when no managers have started and adjusted priority fallback behavior.
Sync Manager Tests
dash-spv/src/sync/{block_headers,blocks,chainlock,filter_headers,filters,instantsend,masternodes}/manager.rs, dash-spv/src/sync/sync_coordinator.rs, dash-spv/src/sync/sync_manager.rs
Updated test assertions across all manager initialization tests to expect WaitForEvents instead of Initializing as the initial state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 No more waiting in the dark, Initializing's lost its spark,
WaitForEvents hops in instead, as the default state ahead,
Managers sync in harmony, with their new priority!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the primary change: removing the SyncState::Initializing variant and replacing it with WaitForEvents as the default state.
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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/drop-initializing-state

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 requested a review from ZocoLini February 21, 2026 13:40
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.

1 participant