Skip to content

Restart background shielded sync after a tree rebuild without overriding a concurrent stop, and report a failed restart #6454

Backlog

Description

@lklimek

TL;DR: After an explicit shielded-tree rebuild, the wallet restarts background shielded sync. That restart can undo a stop the app asked for at the same moment, and when the restart itself fails the rebuild still reports success.

User story

As a wallet app developer, I want a stop request to win over the restart that follows a shielded-tree rebuild, and to be told when that restart fails, to avoid sync running after the user stopped it or silently not running after a successful rebuild.

Scenario

Base flow

The app calls the rebuild while background shielded sync is running. The rebuild pauses sync, resets the tree and then restarts sync as it was before.

Actual behavior

  • A stop requested while the rebuild runs records its intent before it cancels the worker. The rebuild's snapshot of the running state and the stop intent are not taken atomically, so the restart can see an older state and start sync again after the stop.
  • If the background worker cannot be started again, the rebuild still returns success and the app is not told that sync is not running.

Expected behavior

  • A stop requested before or during the rebuild is always honoured: sync stays stopped afterwards.
  • A failed restart is reported to the caller as an error that says the tree was rebuilt but sync did not restart.

Detailed discussion

Code: packages/rs-platform-wallet/src/manager/shielded_sync.rs (the rebuild's quiesce/restart path and stop). Proposed approach: take the stop intent and the worker cancellation under the same guard as the rebuild snapshot (or let the restart re-check a stop generation under that guard), and propagate the worker start result. The task registry in packages/rs-dash-async may need to surface the spawn result to the caller for the second part.

Prior work

🤖 Co-authored by Claudius the Magnificent AI Agent

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions