HomePhabricator

Reduce CTxMemPool constructor call sites

Description

Reduce CTxMemPool constructor call sites

Summary:
This PR reduces the number of call sites where we explicitly construct CTxMemPool. This is done in preparation for later PRs which decouple the mempool module from ArgsManager, eventually all of libbitcoinkernel will be decoupled from ArgsManager.

The changes in this PR:

  • Allows us to have less code churn as we modify CTxMemPool's constructor in later PRs
  • In many cases, we can make use of existing CTxMemPool instances, getting rid of extraneous constructions
  • In other cases, we construct a ChainTestingSetup and use the CTxMemPool there, so that we can rely on the logic in setup_common to set things up correctly

Backport note:

  • see D6451 for why the policy_estimator_test suite already uses a TestingSetup (which inherits ChainTestingSetup)
  • fixed an inconsistent lock order in a Bitcoin ABC specific test case in mempool_tests

This is a backport of core#25215

Test Plan:
With clang and debug:

ninja all check-all bench-bitcoin

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14902

Details

Provenance
Carl Dong <contact@carldong.me>Authored on May 23 2022, 20:19
PiRKCommitted on Dec 5 2023, 12:48
PiRKPushed on Dec 5 2023, 12:48
Reviewer
Restricted Project
Differential Revision
D14902: Reduce CTxMemPool constructor call sites
Parents
rABC070a9269782f: refactor: Pass Peer& to Misbehaving()
Branches
Unknown
Tags
Unknown