|
|
@ -234,5 +234,26 @@ class MultiWalletTest(BitcoinTestFramework):
|
|
|
|
|
|
|
|
|
|
|
|
assert new_wallet_name in self.nodes[0].listwallets()
|
|
|
|
assert new_wallet_name in self.nodes[0].listwallets()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.log.info("Test dynamic wallet unloading")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Test `unloadwallet` errors
|
|
|
|
|
|
|
|
assert_raises_rpc_error(-1, "JSON value is not a string as expected", self.nodes[0].unloadwallet)
|
|
|
|
|
|
|
|
assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", self.nodes[0].unloadwallet, "dummy")
|
|
|
|
|
|
|
|
assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", node.get_wallet_rpc("dummy").unloadwallet)
|
|
|
|
|
|
|
|
assert_raises_rpc_error(-8, "Cannot unload the requested wallet", w1.unloadwallet, "w2"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Successfully unload the specified wallet name
|
|
|
|
|
|
|
|
self.nodes[0].unloadwallet("w1")
|
|
|
|
|
|
|
|
assert 'w1' not in self.nodes[0].listwallets()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Successfully unload the wallet referenced by the request endpoint
|
|
|
|
|
|
|
|
w2.unloadwallet()
|
|
|
|
|
|
|
|
assert 'w2' not in self.nodes[0].listwallets()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Successfully unload all wallets
|
|
|
|
|
|
|
|
for wallet_name in self.nodes[0].listwallets():
|
|
|
|
|
|
|
|
self.nodes[0].unloadwallet(wallet_name)
|
|
|
|
|
|
|
|
assert_equal(self.nodes[0].listwallets(), [])
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
MultiWalletTest().main()
|
|
|
|
MultiWalletTest().main()
|
|
|
|