Conversation
=============================
A new global structure called pWalletMap has been added. Upon initialization, multiple wallets can be loaded.
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 uses a wallet.
Two new RPC methods have been added:
1) listwallets - Returns an array containing wallet names.
2) usewallet - Prefix existing wallet RPC calls with usewallet <walletname> to use a particular wallet. If no wallet is specified, the default wallet is used.
example: bitcoind usewallet foo listreceivedbyaddress 0 true
TODO:
1) Get wallet names from bitcoin.conf in init.cpp.
2) Change help RPC so that the message does not depend on wallet state (i.e. walletpassphrase RPC call)
…to test_bitcoin.cpp
================================================================= You can now specify additional wallets in the config file or via command line arguments: usewallet=foo or bitcoind -usewallet=foo A default wallet called "default" in the RPC and using file "wallet.dat" is always loaded, as to not break compatibility with the master branch. Therefore, additional wallets should neither be called "default" nor "wallet" nor anything else that might conflict with other filenames in the .bitcoin directory. The wallet will be stored in a file called foo.dat. If the wallet doesn't yet exist, it will be created the first time bitcoind is run. TODO: Ensure filename collisions cannot occur. Perhaps allow the wallet files to be arbitrarily named rather than tied to their identifier.
…ons are synched automatically without having to call SyncWithWallets() explicitly. This is important when sending between two wallets in a single bitcoind instance so that the receiving wallet is alerted of the transaction immediately. Removed calls to SyncWithWallets() in ProcessMessage() since SyncWithWallets() is already called by tx.AcceptToMemoryPool(). SyncWithWallets() is still called explicitly from CBlock::ConnectBlock() since the transaction never goes through the mempool in this case.
… methods. Help always returns usage info now.
…ets. getinfo now just shows how many wallets are loaded.
…rpcwallet.cpp into CCryptoKeyStore class. TODO: Encapsulate the thread spawning and make the call nonblocking. Give each thread a unique name.
New Changes: - Moved LoadWallet out of init.cpp and into CWalletMap class. - Added new RPC methods: loadwallet and unloadwallet. TODO: - Clean up I/O in CWalletMap::LoadWallet - debug, error, and UI output functions. - Make sure wallet loading and unloading are thread-safe. - Save wallets to bitcoin.conf automatically.
…tMap now handles unregistration of wallets from main. Added linker option to makefiles for boost_regex.
If at least one -usewallet parameter is given, it will use those parameters to determine which wallets to load at startup. If no -usewallet parameters are given, it searches the data directory for files named wallet-<walletname>.dat. Also added -nousewallet parameters which override either -usewallet or the data directory.
… to within the class methods themselves and out of bitcoinrpc.cpp, wallet unload locks on individual wallet rather than all wallets.
… rather than iterating through the wallet map in init.
|
Nice! It's a huge pull request though; will take some time to look at it. BTW: seems there is a merge problem? |
|
The merge is actually not that horrible... |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/227637f431b1994d0d87b66993129fd4a1e0a0e1 for binaries and test log. |
|
Automatic sanity-testing: FAILED MERGE, see http://jenkins.bluematt.me/pull-tester/18ad19fbde0688645f52e26ae545da2849d7c9b4 for test log. This pull does not merge cleanly onto current master |
|
Needs a rebase to keep up with autotools. |
|
Actually, I accidentally pushed this - I am no longer supporting this branch and will close the pull request. |
Added ability to load/unload multiple wallets dynamically in bitcoin-qt