Is there a way to delete a test wallet without stopping bitcoind?

0

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?

electrotype

Posted 2019-10-21T09:11:39.470

Reputation: 151

2Why are you using testnet? Regtest mode exists explicitly for that purpose.Anonymous 2019-10-21T10:09:32.370

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!electrotype 2019-10-21T13:47:11.877

Why do you want to? You can just restart the node.Anonymous 2019-10-21T13:47:47.543

That is exactly what I try to avoid and why I ask this question in the first place! :-)electrotype 2019-10-21T16:45:44.427

You seem to be very confused i to believing that restarting a node during a unit test is somehow bad or abnormal.Anonymous 2019-10-21T16:46:19.823

Well, recreating a wallet would make way more sense in my case and would be way faster (even if I'm sure the regTest node is faster to restart than a testnet one). I guess I'll indeed have to restart the node, if wallets can't be deleted otherwise. Thanks.electrotype 2019-10-21T17:06:35.373

1It takes seconds to restart a regtest node. Faster than whining on stack exhange about it.Anonymous 2019-10-21T17:07:21.457

Answers

1

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

Andrew Chow

Posted 2019-10-21T09:11:39.470

Reputation: 40 910