HomePhabricator

Avoid a copy when inserting a mempool entry

Description

Avoid a copy when inserting a mempool entry

Summary:
We already store a unique_ptr, so we can leverage this to avoid the copy.
To avoid creating new copies the copy constructor operator is explicitely deleted.
A move constructor also needs to be created as this is used in the tests.

Note that we don't need assignment operators because the class has const
members.

This will make it easier to reason about when we later update to a RCUPtr, because it uses
an atomic and cannot be copied.

Depends on D13443.

Test Plan:

ninja all check-all

Run the asan build;

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
FabienAuthored on Jan 9 2024, 09:13
FabienPushed on Jan 15 2024, 13:18
Reviewer
Restricted Project
Differential Revision
D15147: Avoid a copy when inserting a mempool entry
Parents
rABC5471411dba6d: Migrate the mempool to hold shared pointers
Branches
Unknown
Tags
Unknown