bitcoin/bitcoin — pull request #2124 by CodeShark (2012-12-23 13:30:58+00:00)
Title: Added multiple wallet support

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:
- listwallets - Returns an array containing wallet names.
- usewallet - Prefix existing wallet RPC calls with usewallet to use a particular wallet. If no wallet is specified, the default wallet is used.
- example: bitcoind usewallet foo listreceivedbyaddress 0 true

If wallet RPC calls are made without usewallet, the default wallet is used as to not break compatibility with single wallet versions of bitcoind.

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)