Mempool refactor

I want to get these cleanups into master now to safe work on merge conflicts later.

The first commit just moves most of the mempool-related code from main.cpp to txmempool.{cpp,h}

The second is a couple of small refactors that changes no functionality.