Bitcoin Core 28.99.0
P2P Digital Currency
|
Class encapsulating the state needed to find the best remaining ancestor set. More...
#include <cluster_linearize.h>
Public Member Functions | |
AncestorCandidateFinder (const DepGraph< SetType > &depgraph LIFETIMEBOUND) noexcept | |
Construct an AncestorCandidateFinder for a given cluster. More... | |
void | MarkDone (SetType select) noexcept |
Remove a set of transactions from the set of to-be-linearized ones. More... | |
bool | AllDone () const noexcept |
Check whether any unlinearized transactions remain. More... | |
ClusterIndex | NumRemaining () const noexcept |
Count the number of remaining unlinearized transactions. More... | |
SetInfo< SetType > | FindCandidateSet () const noexcept |
Find the best (highest-feerate, smallest among those in case of a tie) ancestor set among the remaining transactions. More... | |
Private Attributes | |
const DepGraph< SetType > & | m_depgraph |
Internal dependency graph. More... | |
SetType | m_todo |
Which transaction are left to include. More... | |
std::vector< FeeFrac > | m_ancestor_set_feerates |
Precomputed ancestor-set feerates (only kept up-to-date for indices in m_todo). More... | |
Class encapsulating the state needed to find the best remaining ancestor set.
It is initialized for an entire DepGraph, and parts of the graph can be dropped by calling MarkDone.
As long as any part of the graph remains, FindCandidateSet() can be called which will return a SetInfo with the highest-feerate ancestor set that remains (an ancestor set is a single transaction together with all its remaining ancestors).
Definition at line 529 of file cluster_linearize.h.
|
inlinenoexcept |
Construct an AncestorCandidateFinder for a given cluster.
Complexity: O(N^2) where N=depgraph.TxCount().
The remaining ancestors for transaction i.
Definition at line 543 of file cluster_linearize.h.
|
inlinenoexcept |
Check whether any unlinearized transactions remain.
Definition at line 589 of file cluster_linearize.h.
|
inlinenoexcept |
Find the best (highest-feerate, smallest among those in case of a tie) ancestor set among the remaining transactions.
Requires !AllDone().
Complexity: O(N) where N=depgraph.TxCount();
Definition at line 605 of file cluster_linearize.h.
|
inlinenoexcept |
Remove a set of transactions from the set of to-be-linearized ones.
The same transaction may not be MarkDone()'d twice.
Complexity: O(N*M) where N=depgraph.TxCount(), M=select.Count().
Definition at line 575 of file cluster_linearize.h.
|
inlinenoexcept |
Count the number of remaining unlinearized transactions.
Definition at line 595 of file cluster_linearize.h.
|
private |
Precomputed ancestor-set feerates (only kept up-to-date for indices in m_todo).
Definition at line 536 of file cluster_linearize.h.
|
private |
Internal dependency graph.
Definition at line 532 of file cluster_linearize.h.
|
private |
Which transaction are left to include.
Definition at line 534 of file cluster_linearize.h.