mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-20 20:49:50 +01: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:
@@ -176,7 +176,15 @@ static CTxMemPool::Options&& Flatten(CTxMemPool::Options&& opts, bilingual_str&
|
||||
CTxMemPool::CTxMemPool(Options opts, bilingual_str& error)
|
||||
: m_opts{Flatten(std::move(opts), error)}
|
||||
{
|
||||
m_txgraph = MakeTxGraph(m_opts.limits.cluster_count, m_opts.limits.cluster_size_vbytes * WITNESS_SCALE_FACTOR, ACCEPTABLE_ITERS);
|
||||
m_txgraph = MakeTxGraph(
|
||||
/*max_cluster_count=*/m_opts.limits.cluster_count,
|
||||
/*max_cluster_size=*/m_opts.limits.cluster_size_vbytes * WITNESS_SCALE_FACTOR,
|
||||
/*acceptable_iters=*/ACCEPTABLE_ITERS,
|
||||
/*fallback_order=*/[&](const TxGraph::Ref& a, const TxGraph::Ref& b) noexcept {
|
||||
const Txid& txid_a = static_cast<const CTxMemPoolEntry&>(a).GetTx().GetHash();
|
||||
const Txid& txid_b = static_cast<const CTxMemPoolEntry&>(b).GetTx().GetHash();
|
||||
return txid_a <=> txid_b;
|
||||
});
|
||||
}
|
||||
|
||||
bool CTxMemPool::isSpent(const COutPoint& outpoint) const
|
||||
|
||||
Reference in New Issue
Block a user