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:
  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)
Added CWallet* parameter to RPC test suite and a CWalletMap instance to test_bitcoin.cpp
Fixed RPC issues detected by test suite.
Added loading of wallet names and files from -usewallet arguments
=================================================================

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.
TxMemPool::accept() calls SyncWithWallets(), so all mempool transactions 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.
Modified getinfo RPC call to return an array of wallets
Removed dependency on wallet encryption state for getting help on RPC methods. Help always returns usage info now.
usewallet now checks whether method is valid.
Fixed LOCK to lock appropriate wallet.
Fixed wallet load time indicator.
Moved wallet detail information out of getinfo and put it in listwallets. getinfo now just shows how many wallets are loaded.
Moved code for locking a wallet automatically at a certain time from rpcwallet.cpp into CCryptoKeyStore class.

TODO:
  Encapsulate the thread spawning and make the call nonblocking.
  Give each thread a unique name.
Dynamic loading and unloading of wallets.

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.
New naming scheme for wallets. Checks for valid character set. CWalletMap now handles unregistration of wallets from main.
Added linker option to makefiles for boost_regex.
More load options at startup.

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.
Thread-safe CWalletMap.
Using GetWallet instead of pWalletMap->wallets.find
Using GetWallet instead of pWalletMap->wallets.find
Merge branch 'multiwallet' of 108.60.150.142:../gitrepos/bitcoin into multiwallet
Moved RPC type conversion for usewallet to RPCConvertValues function.