mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-12 08:37:58 +02:00
txgraph: pass fallback_order to TxGraph (preparation)
This adds an std::function<strong_ordering(Ref&,Ref&)> argument to the MakeTxGraph function, which can be used by the caller (e.g., mempool code) to provide a fallback order to TxGraph. This is just preparation; TxGraph does not yet use this fallback order for anything.
This commit is contained in:
@@ -403,6 +403,8 @@ private:
|
||||
/** The number of linearization improvement steps needed per cluster to be considered
|
||||
* acceptable. */
|
||||
const uint64_t m_acceptable_iters;
|
||||
/** Fallback ordering for transactions. */
|
||||
const std::function<std::strong_ordering(const TxGraph::Ref&, const TxGraph::Ref&)> m_fallback_order;
|
||||
|
||||
/** Information about one group of Clusters to be merged. */
|
||||
struct GroupEntry
|
||||
@@ -621,11 +623,17 @@ private:
|
||||
std::vector<GraphIndex> m_unlinked;
|
||||
|
||||
public:
|
||||
/** Construct a new TxGraphImpl with the specified limits. */
|
||||
explicit TxGraphImpl(DepGraphIndex max_cluster_count, uint64_t max_cluster_size, uint64_t acceptable_iters) noexcept :
|
||||
/** Construct a new TxGraphImpl with the specified limits and fallback order. */
|
||||
explicit TxGraphImpl(
|
||||
DepGraphIndex max_cluster_count,
|
||||
uint64_t max_cluster_size,
|
||||
uint64_t acceptable_iters,
|
||||
const std::function<std::strong_ordering(const TxGraph::Ref&, const TxGraph::Ref&)>& fallback_order
|
||||
) noexcept :
|
||||
m_max_cluster_count(max_cluster_count),
|
||||
m_max_cluster_size(max_cluster_size),
|
||||
m_acceptable_iters(acceptable_iters),
|
||||
m_fallback_order(fallback_order),
|
||||
m_main_chunkindex(ChunkOrder(this))
|
||||
{
|
||||
Assume(max_cluster_count >= 1);
|
||||
@@ -3523,7 +3531,11 @@ TxGraph::Ref::Ref(Ref&& other) noexcept
|
||||
std::swap(m_index, other.m_index);
|
||||
}
|
||||
|
||||
std::unique_ptr<TxGraph> MakeTxGraph(unsigned max_cluster_count, uint64_t max_cluster_size, uint64_t acceptable_iters) noexcept
|
||||
std::unique_ptr<TxGraph> MakeTxGraph(
|
||||
unsigned max_cluster_count,
|
||||
uint64_t max_cluster_size,
|
||||
uint64_t acceptable_iters,
|
||||
const std::function<std::strong_ordering(const TxGraph::Ref&, const TxGraph::Ref&)>& fallback_order) noexcept
|
||||
{
|
||||
return std::make_unique<TxGraphImpl>(max_cluster_count, max_cluster_size, acceptable_iters);
|
||||
return std::make_unique<TxGraphImpl>(max_cluster_count, max_cluster_size, acceptable_iters, fallback_order);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user