mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 18:22:57 +02:00
Merge bitcoin/bitcoin#30857: cluster mempool: extend DepGraph functionality
0b3ec8c59bclusterlin: remove Cluster type (Pieter Wuille)1c24c62510clusterlin: merge two DepGraph fuzz tests into simulation test (Pieter Wuille)0606e66fdbclusterlin: add DepGraph::RemoveTransactions and support for holes in DepGraph (Pieter Wuille)75b5d42419clusterlin: make DepGraph::AddDependency support multiple dependencies at once (Pieter Wuille)abf50649d1clusterlin: simplify DepGraphFormatter::Ser (Pieter Wuille)eaab55ffc8clusterlin: rework DepGraphFormatter::Unser (Pieter Wuille)5901cf7100clusterlin: abstract out DepGraph::GetReduced{Parents,Children} (Pieter Wuille) Pull request description: Part of cluster mempool: #30289 This adds: * `DepGraph::AddDependencies` to add 0 or more dependencies to a single transaction at once (identical to calling `DepGraph::AddDependency` once for each, but more efficient). * `DepGraph::RemoveTransactions` to remove 0 or more transactions from a depgraph. * `DepGraph::GetReducedParents` (and `DepGraph::GetReducedChildren`) to get the (reduced) direct parents and children of a transaction in a depgraph. After which, the `Cluster` type is removed. This is the result of fleshing out the design for the "intermediate layer" ("TxGraph", no PR yet) between the cluster linearization layer and the mempool layer. My earlier thinking was that TxGraph would store `Cluster` objects (vectors of pairs of `FeeFrac`s and sets of parents), and convert them to `DepGraph` on the fly whenever needed. However, after more consideration, it seems better to have TxGraph store `DepGraph` objects, and manipulate them directly without constantly re-creating them. This requires `DepGraph` to have some additional functionality. The bulk of the complexity here is the addition of `DepGraph::RemoveTransactions`, which leaves the remaining transactions' positions within the `DepGraph` untouched (we want existing identifiers to remain valid), so this implies that graphs can now have "holes" (positions that are unused, but followed by positions that are used). To enable that, an extension of the fuzz/test serialization format `DepGraphFormatter` is included to deal with such holes. ACKs for top commit: sdaftuar: reACK0b3ec8c59binstagibbs: reACK0b3ec8c59bismaelsadeeq: reACK0b3ec8c59bglozow: ACK0b3ec8c59b, reviewed range-diff from aab53ddcd8fcbc3c0be0da9383f8e06abe5badda and `clusterlin_depgraph_sim` Tree-SHA512: a804b7f26d544c5cb0847322e235c810525cb0607737be6116c3156d582da3ba3352af8ea48e74eed5268f9c3eca63b30181d01b23a6dd0be1b99191f81cceb0
This commit is contained in:
@@ -40,7 +40,7 @@ void assertion_fail(std::string_view file, int line, std::string_view func, std:
|
||||
|
||||
/** Helper for Assert()/Assume() */
|
||||
template <bool IS_ASSERT, typename T>
|
||||
T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* file, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* assertion)
|
||||
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* file, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* assertion)
|
||||
{
|
||||
if constexpr (IS_ASSERT
|
||||
#ifdef ABORT_ON_FAILED_ASSUME
|
||||
|
||||
@@ -64,13 +64,13 @@ struct FeeFrac
|
||||
int32_t size;
|
||||
|
||||
/** Construct an IsEmpty() FeeFrac. */
|
||||
inline FeeFrac() noexcept : fee{0}, size{0} {}
|
||||
constexpr inline FeeFrac() noexcept : fee{0}, size{0} {}
|
||||
|
||||
/** Construct a FeeFrac with specified fee and size. */
|
||||
inline FeeFrac(int64_t f, int32_t s) noexcept : fee{f}, size{s} {}
|
||||
constexpr inline FeeFrac(int64_t f, int32_t s) noexcept : fee{f}, size{s} {}
|
||||
|
||||
inline FeeFrac(const FeeFrac&) noexcept = default;
|
||||
inline FeeFrac& operator=(const FeeFrac&) noexcept = default;
|
||||
constexpr inline FeeFrac(const FeeFrac&) noexcept = default;
|
||||
constexpr inline FeeFrac& operator=(const FeeFrac&) noexcept = default;
|
||||
|
||||
/** Check if this is empty (size and fee are 0). */
|
||||
bool inline IsEmpty() const noexcept {
|
||||
|
||||
Reference in New Issue
Block a user