Page MenuHomePhabricator

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

Authored by PiRK on Nov 9 2022, 16:58.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Nov 9 2022, 16:58
Fabien requested changes to this revision.Nov 9 2022, 17:34
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/txmempool.h
611 ↗(On Diff #36202)

You're missing the doxygen from the PR

This revision now requires changes to proceed.Nov 9 2022, 17:34
This revision is now accepted and ready to land.Nov 10 2022, 13:36