HomePhabricator

move check_final_and_mature lambda from CTxMemPool::removeForReorg to…

Description

move check_final_and_mature lambda from CTxMemPool::removeForReorg to DisconnectedBlockTransactions::updateMempoolForReorg

Summary:
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

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Nov 3 2022, 14:05
PiRKPushed on Nov 10 2022, 15:05
Reviewer
Restricted Project
Differential Revision
D12448: move check_final_and_mature lambda from CTxMemPool::removeForReorg to DisconnectedBlockTransactions::updateMempoolForReorg
Parents
rABC93a3ae2a01e8: [mempool] always assert coin spent and do it only once in a row
Branches
Unknown
Tags
Unknown