Skip to content

feat: persist and restore target height via MetadataStorage#476

Draft
xdustinface wants to merge 4 commits intorefactor/move-initializationfrom
feat/persist-last-target
Draft

feat: persist and restore target height via MetadataStorage#476
xdustinface wants to merge 4 commits intorefactor/move-initializationfrom
feat/persist-last-target

Conversation

@xdustinface
Copy link
Collaborator

Introduce new functions in MetadataStorage to save/load the last known target height, and integrate it into the block headers manager. This allows the UI to show a more realistic state after restart during sync before connections are established.

Based on:

commit 5f664d3
Author: xdustinface <xdustinfacex@gmail.com>
Date:   Thu Feb 12 20:03:27 2026 +0100

    feat: report/propagate client start/run failures

    We currently just silently ignore any failure inside the sync coordinator or `monitor_network` thread. This PR propagates them and also adds a FFI callback structure which can be set to receive notifications about errors inside the SPV client.
Remove dash_spv_ffi_manager_sync_progress_destroy and move the
nested-pointer cleanup logic into dash_spv_ffi_sync_progress_destroy.
Having two destroy functions for the same type caused the memory leak.
- Moves initialization logic out of the `SyncManager::initialize()` trait method and into each manager's constructor.
- Genesis block is now stored before managers are created, so they can read the tip during construction.
- The `SyncCoordinator` seeds initial progress from actual manager state instead of default and uses `WatchStream::from_changes` to avoid re-emitting all initial progresses.
Introduce new functions in `MetadataStorage` to save/load the last known target height, and integrate it into the block headers manager. This allows the UI to show a more realistic state after restart during sync before connections are established.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/persist-last-target

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 force-pushed the refactor/move-initialization branch from 89ab17e to 8e08c35 Compare February 26, 2026 16:45
@github-actions github-actions bot added the merge-conflict The PR conflicts with the target branch. label Feb 26, 2026
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR conflicts with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant