rpc: Remove mempool global from miner
Summary:
The miner needs read-only access to the mempool. Instead of using the mutable global ::mempool, keep a immutable reference to a mempool that is passed to the miner. Apart from the obvious benefits of removing a global and making things immutable, this might also simplify testing with multiple mempools.
Backport of core PR17781.
Depends on D7984.
This differs quite a bit from the original PR because we already passed
a mempool. This is mostly rename and factorization to make it looks more
like core.
Test Plan:
ninja all check-all ninja bench-bitcoin
With clang:
ninja check
Reviewers: #bitcoin_abc, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Subscribers: jasonbcox
Differential Revision: https://reviews.bitcoinabc.org/D7988