mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-12 14:44:00 +02:00
Merge #13111: Add unloadwallet RPC
fe65bdec2
bugfix: Delete walletView in WalletFrame::removeWallet (João Barbosa)0b82bac76
bugfix: Remove dangling wallet env instance (João Barbosa)0ee77b207
ui: Support wallets unloaded dynamically (João Barbosa)9f9b50d5f
doc: Add release notes for unloadwallet RPC (João Barbosa)ccbf7ae74
test: Wallet methods are disabled when no wallet is loaded (João Barbosa)4940a20a4
test: Add functional tests for unloadwallet RPC (João Barbosa)6608c369b
rpc: Add unloadwallet RPC (João Barbosa)537efe19e
rpc: Extract GetWalletNameFromJSONRPCRequest from GetWalletForJSONRPCRequest (João Barbosa) Pull request description: This patch adds wallet unload feature via RPC. It also adds UI support for unloaded wallets. Tree-SHA512: 7c7f9f32f7a2266d2df574aa6b95f993c3dc82736f93304562122beb8756fb28cd22d03866b48f493c747441f22d30e196b098dec435cc25e035633f090351ea
This commit is contained in:
@ -234,5 +234,32 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
|
||||
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(), [])
|
||||
assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
|
||||
|
||||
# Successfully load a previously unloaded wallet
|
||||
self.nodes[0].loadwallet('w1')
|
||||
assert_equal(self.nodes[0].listwallets(), ['w1'])
|
||||
assert_equal(w1.getwalletinfo()['walletname'], 'w1')
|
||||
|
||||
if __name__ == '__main__':
|
||||
MultiWalletTest().main()
|
||||
|
Reference in New Issue
Block a user