forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add loadwallet and createwallet RPC load_on_startup options
This maintains a persistent list of wallets stored in settings that will automatically be loaded on startup. Being able to load a wallet automatically on startup will be more useful in the GUI when the option to create wallets is added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
- Loading branch information
Showing
8 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2017-2019 The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
"""Test wallet load on startup. | ||
Verify that a bitcoind node can maintain list of wallets loading on startup | ||
""" | ||
from test_framework.test_framework import BitcoinTestFramework | ||
from test_framework.util import ( | ||
assert_equal, | ||
) | ||
|
||
|
||
class WalletStartupTest(BitcoinTestFramework): | ||
def set_test_params(self): | ||
self.setup_clean_chain = True | ||
self.num_nodes = 1 | ||
self.supports_cli = True | ||
|
||
def skip_test_if_missing_module(self): | ||
self.skip_if_no_wallet() | ||
|
||
def run_test(self): | ||
node = self.nodes[0] | ||
|
||
self.nodes[0].createwallet(wallet_name='w0', load_on_startup=True) | ||
self.nodes[0].createwallet(wallet_name='w1', load_on_startup=False) | ||
self.nodes[0].createwallet(wallet_name='w2', load_on_startup=True) | ||
self.nodes[0].createwallet(wallet_name='w3', load_on_startup=False) | ||
self.nodes[0].createwallet(wallet_name='w4', load_on_startup=False) | ||
self.nodes[0].unloadwallet(wallet_name='w0') | ||
self.nodes[0].unloadwallet(wallet_name='w4') | ||
self.nodes[0].loadwallet(filename='w4', load_on_startup=True) | ||
assert_equal(set(node.listwallets()), set(('', 'w1', 'w2', 'w3', 'w4'))) | ||
self.stop_nodes() | ||
self.start_node(0, []) | ||
assert_equal(set(node.listwallets()), set(('w2', 'w4'))) | ||
|
||
if __name__ == '__main__': | ||
WalletStartupTest().main() |