Mempool refactor

I want to get these cleanups into master now to save work on merge conflicts later.

This mostly just moves mempool-related code from main.cpp to txmempool.{cpp,h}

There are a few small refactors:

+ nTransactionsUpdated moved from a global var to a mempool private var (with accessor functions)
+ Made all the CTxMemPool methods thread safe (they take the mempool.cs lock)
+ Folded mempool.exists() into mempool.lookup() to avoid possible multithreading bugs and simplify calling code
+ Found and fixed a potential bug in main.cpp where mempool.mapNextTx was accessed without holding the mempool.cs lock