Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
cluster_linearize::AncestorCandidateFinder< SetType > Class Template Reference

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< FeeFracm_ancestor_set_feerates
 Precomputed ancestor-set feerates (only kept up-to-date for indices in m_todo). More...
 

Detailed Description

template<typename SetType>
class cluster_linearize::AncestorCandidateFinder< SetType >

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.

Constructor & Destructor Documentation

◆ AncestorCandidateFinder()

template<typename SetType >
cluster_linearize::AncestorCandidateFinder< SetType >::AncestorCandidateFinder ( const DepGraph< SetType > &depgraph  LIFETIMEBOUND)
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.

Member Function Documentation

◆ AllDone()

template<typename SetType >
bool cluster_linearize::AncestorCandidateFinder< SetType >::AllDone ( ) const
inlinenoexcept

Check whether any unlinearized transactions remain.

Definition at line 589 of file cluster_linearize.h.

Here is the caller graph for this function:

◆ FindCandidateSet()

template<typename SetType >
SetInfo< SetType > cluster_linearize::AncestorCandidateFinder< SetType >::FindCandidateSet ( ) const
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MarkDone()

template<typename SetType >
void cluster_linearize::AncestorCandidateFinder< SetType >::MarkDone ( SetType  select)
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.

Here is the caller graph for this function:

◆ NumRemaining()

template<typename SetType >
ClusterIndex cluster_linearize::AncestorCandidateFinder< SetType >::NumRemaining ( ) const
inlinenoexcept

Count the number of remaining unlinearized transactions.

Definition at line 595 of file cluster_linearize.h.

Here is the caller graph for this function:

Member Data Documentation

◆ m_ancestor_set_feerates

template<typename SetType >
std::vector<FeeFrac> cluster_linearize::AncestorCandidateFinder< SetType >::m_ancestor_set_feerates
private

Precomputed ancestor-set feerates (only kept up-to-date for indices in m_todo).

Definition at line 536 of file cluster_linearize.h.

◆ m_depgraph

template<typename SetType >
const DepGraph<SetType>& cluster_linearize::AncestorCandidateFinder< SetType >::m_depgraph
private

Internal dependency graph.

Definition at line 532 of file cluster_linearize.h.

◆ m_todo

template<typename SetType >
SetType cluster_linearize::AncestorCandidateFinder< SetType >::m_todo
private

Which transaction are left to include.

Definition at line 534 of file cluster_linearize.h.


The documentation for this class was generated from the following file: