Wallet/RPC Optimizations

Short version. This pull request includes all the changes in request #264 plus additional changes that should make wallet related functions much faster. For comparison, getbalance "*" execution time on my wallet went from ~120-130mS to around 2.5mS with these changes. Any functions that rely on balance calculations (sendfrom, sendmany,  etc) can expect to see similar performance boosts.

Longer version. RPC commands that use accounts (and many do whether you want them to or not) calculate the balance by going through every. single. transaction. in your wallet and crediting/debiting the appropriate amount to an account. This means it also goes through every. single. transaction. output. in each transaction to make sure none of these coins are yours. To check these outputs it has to solve the script for each output to determine the address then check to see if that address belongs to you. This is especially painful for p2pool transactions, sendmany transactions that you created, pretty much any transaction with a lot of outputs. For example if you create a sendmany transaction sending coins to 100 addresses then every time your balance is calculated all of the output addresses are checked to make sure they don't need to be credited to you. 

To address this, this pull request now only checks to see if an output belongs to you once and caches the result. 

Couple other notes:
* Probably goes without saying, but make sure the block chain is completely downloaded before attempting to compare the change in performance. The client is riddled with semaphores that make it hard to isolate performance differences if there are other active threads.
* You may not notice a change in performance the first time you call getbalance "*", et al. In fact it may be a tiny bit slower. Subsequent calls should be much faster.
* The number of "CWalletTx::GetAmounts: Unknown transaction..." messages in your logs (assuming you're seeing these) should decrease dramatically since these transactions should only be evaluated once.