HomePhabricator

Migrate the mempool to hold shared pointers

Description

Migrate the mempool to hold shared pointers

Summary:
The mempool actually stores CTxMemPoolEntry objects, which are wrappers
around transactions with added/cached statistics. Since there is a
single mempool this is not a problem and all the algorithms are using
iterators and/or references to manipulate the objects that remain owned
by the mempool.

With pre-consensus we will need to move these entries to other data
structures: the conflicting txs will be voted on and need to be stored,
and we want to build a tree of the finalized txs that will be used to
generate the block template.

In order to not lose and having to recompute the cached data (especially
the fees) we need to be able to move the entries from one container to
another. Using a shared pointer is a step in this direction. In the end
we will probably use a RCUPtr but this require additional refactors,
as it makes the entry non copyable. This first step is the purpose of
this diff.

Depends on D13439 and D13440.

Test Plan:
With debug:

ninja all check-all

ninja check-extended

Run the ASAN, UBSAN and TSAN builds.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
FabienAuthored on Mar 15 2023, 13:52
FabienPushed on Jan 15 2024, 13:18
Reviewer
Restricted Project
Differential Revision
D13443: Migrate the mempool to hold shared pointers
Parents
rABC9fe11d18aec3: [Chronik] Add `MempoolTokens` to index mempool token txs
Branches
Unknown
Tags
Unknown