Skip to content

fix: correct initial percentage to only average active managers - #471

Merged
xdustinface merged 1 commit into
v0.42-devfrom
fix/initial-percentage
Feb 26, 2026
Merged

xdustinface merged 1 commit into
v0.42-devfrom
fix/initial-percentage

Conversation

@xdustinface

@xdustinface xdustinface commented Feb 25, 2026 •

Copy link
Copy Markdown
Collaborator

At the moment None managers use unwrap_or(0.0) which dragged down the percentage when only some managers are active like when filters are disabled, only block headers are active. With this PR only phases that have actually started contribute to the average.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Enhanced sync progress tracking by refining how synchronization phases are aggregated, ensuring progress percentages now accurately reflect only active phases for more precise progress reporting.

At the moment `None` managers use `unwrap_or(0.0)` which dragged down the percentage when
only some managers are active like when filters are disabled, only block headers are active.
With this PR only phases that have actually started contribute to the average.
@coderabbitai

coderabbitai Bot commented Feb 25, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26e7bc4 and af96e79.

📒 Files selected for processing (2)
  • dash-spv/src/sync/progress.rs
  • dash-spv/src/sync/sync_coordinator.rs

📝 Walkthrough

Walkthrough

The percentage calculation for sync progress is refined to only aggregate percentages from active managers, ignoring None values, and returns 0.0 when no managers are active. Tests are updated to reflect the new calculation behavior, and a new method update_committed_height() is introduced to FiltersProgress.

Changes

Cohort / File(s) Summary
Progress Calculation
dash-spv/src/sync/progress.rs
Modified percentage aggregation to only include active managers, removing the previous default 1.0 for missing percentages. Added documentation clarifying that only active managers contribute to the average.
Test Updates and New Method
dash-spv/src/sync/sync_coordinator.rs
Updated test expectations to match new progress calculation (0.0 when all phases are None, 0.5 for mixed phases). Added update_committed_height() method to FiltersProgress and expanded test imports and scenarios.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Hopping through percentages with care,
Active managers now get their fair share,
No phantom ones hiding in sight,
The sync progress calculations feel right!
Tests align with logic so clear, ✨

🚥 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 directly and clearly describes the main fix: correcting the percentage calculation to only average active managers, which is the core change across both modified files.
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 fix/initial-percentage

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 26, 2026 01:45
@xdustinface
xdustinface merged commit 15ac03d into v0.42-dev Feb 26, 2026
52 checks passed
@xdustinface
xdustinface deleted the fix/initial-percentage branch February 26, 2026 15:57
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