bitcoind now supports loading more than one wallet at once.
A singleton object of type CWalletManager now exists. It handles dynamic loading/unloading and synchronization of wallets and allows different parts of the application to access wallets by name.
A new CWallet* parameter has been added to the RPC functions. Functions which do not use a wallet simply ignore it. In addition, a new field has been added to CRPCCommand that tells us whether or not the function can be called on a wallet.
Wallet-specific information has been removed from RPC method getinfo. Instead, getinfo just reports how many wallets are currently loaded. Detailed wallet info is now available via the listwallets method.
Four new RPC methods have been added:
- listwallets Returns an array containing wallet information.
- usewallet [params] Allows you to apply existing RPC commands to different wallets. A default wallet named the empty string is always loaded and is used if calls are made without usewallet. Example: bitcoind usewallet foo listreceivedbyaddress 0 true (thanks, gmaxwell, for the idea)
- loadwallet [rescan=false] [upgradewallet=false] [maxversion=(latest)] Dynamically loads an existing wallet file wallet-.dat. If no wallet file exists a new wallet is created. The default wallet file is always called wallet.dat.
- unloadwallet
To specify additional wallets at startup, use option -usewallet=foo -usewallet=bar etc…as detailed here: #2124 (comment) and https://github.com/CodeShark/bitcoin/commit/9d201cfaf9f54042ec0ff8265cd2201545568b6d
TODO:
- Clean up I/O in CWalletManager::LoadWallet - debug, error, and UI output functions.
- Check synchronization code.
- Test mining functionality. Allow RPC mining on arbitrary wallets.
- Integrate with Qt.