This is the first step toward making the mempool a global that is not initialized before main.
Motivation
Currently the mempool is a global that is initialized before the main
function. This is confusing and easy to get wrong. E.g. the mempool constructor queries state that has not been initialized, like randomness (fixed), or command line arguments (not an issue last time I checked). Also without having the chainstate (chain tip) initialized first, it doesn’t make conceptually sense to have a mempool, since the mempool builds txs on top of the utxo set (chain tip).
Finally, in the future someone might want to run a consensus-only full node (-nowallet -noblockfilter -no... -nomempool
command line options) that only verifies blocks and updates the utxo set.
This is conceptually the same change that has already been done for the connection manager CConnman
.