Original commit:
Break validation <-> txmempool circular dependency
No behavior change.
Parameterize removeForReorg using a CChain and callable that
encapsulates validation logic. The mempool shouldn't need to know a
bunch of details about coinbase maturity and lock finality. Instead,
just pass in a callable function that says true/false. Breaks circular
dependency by removing txmempool's dependency on validation.
We cannot break the circular dependency because updateMempoolForReorg is not a CChainstate member function in Bitcoin ABC, but a member of a different class that depends both on validation and txmempool for now. See D1667. Breaking the circular dependency is not a good enough reason to undo the change from D1667, because it would mean exposing the DisconnectedBlockTransactions internals to validation.
This concludes backport of core#22677
https://github.com/bitcoin/bitcoin/pull/22677/commits/a64078e38563ef3ac5e5ec20c07569441c87eeee
Depends on D12446