Skip to content

kotlin-sdk: clearSpvStorage is a guaranteed no-op after stopSpv (loses the dataDir) #4070

Closed

Description

@bfoss765

Found while recovering from #4069 on-device: SpvRuntime::stop() does self.client.take(), dropping the DashSpvClient that holds the DiskStorageManager (and with it the configured dataDir). SpvRuntime::clear_storage() requires client to be Some — so the natural integrator sequence stopSpv() → clearSpvStorage() → startSpv() errors ("SPV Client not started") without touching disk: the header store and scan watermark survive, the restart resumes SYNCED in seconds, and any wallet-state reset the integrator performed never repopulates (stuck zero-balance view). Clearing while running instead races the client's ~5s persistence worker.

Request: clearSpvStorage should honor the configured dataDir when the client is stopped (remember the last dataDir, or accept it as a parameter). The Android wallet currently works around it by recursively deleting the dataDir at the filesystem level.

cc @QuantumExplorer for review.

Context: dashpay/dash-wallet#1507 Phase 5a; discovered recovering from #4069. 🤖 Filed with Claude Code

Activity

  1. HashEngineering commented on Nov 9, 2026

    @HashEngineering
    Collaborator

    Fixed by #4042. SpvRuntime::clear_storage falls back to the last config when the client is stopped, so clearSpvStorage after stopSpv now clears the data directory on disk. Closing.

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