Part of cluster mempool: #30289
This adds:
DepGraph::AddDependencies
to add 0 or more dependencies to a single transaction at once (identical to callingDepGraph::AddDependency
once for each, but more efficient).DepGraph::RemoveTransactions
to remove 0 or more transactions from a depgraph.DepGraph::GetReducedParents
(andDepGraph::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.