For my unit tests, I'd like to be able to delete and recreate a wallet without having to stop bitcoind and manually deleting the wallet directory.

When I try to delete such wallet directory without stopping bitcoind, I get an error since an handle exists on "db.log" (on Windows at least).

Is there a clean way to delete a (testnet) wallet without stopping bitcoind?

  • 2
    Why are you using testnet? Regtest mode exists explicitly for that purpose.
    – Claris
    Oct 21 '19 at 10:09
  • Would bitcoind really allow me to delete a wallet when running on regtest? For some reason I doubt it would make any difference... I guess I should try! Oct 21 '19 at 13:47
  • Why do you want to? You can just restart the node.
    – Claris
    Oct 21 '19 at 13:47
  • That is exactly what I try to avoid and why I ask this question in the first place! :-) Oct 21 '19 at 16:45
  • 1
    It takes seconds to restart a regtest node. Faster than whining on stack exhange about it.
    – Claris
    Oct 21 '19 at 17:07

You can unload the wallet using unloadwallet and then delete the wallet file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.