clusterlin: use 'cost' terminology instead of 'iters' (refactor)

This commit is contained in:
Pieter Wuille
2026-02-21 10:11:54 -05:00
committed by Pieter Wuille
parent 9e7129df29
commit ecc9a84f85
12 changed files with 111 additions and 91 deletions

View File

@@ -102,10 +102,10 @@ public:
virtual void SetTransactionFee(const Ref& arg, int64_t fee) noexcept = 0;
/** TxGraph is internally lazy, and will not compute many things until they are needed.
* Calling DoWork will perform some work now (controlled by iters) so that future operations
* Calling DoWork will perform some work now (controlled by max_cost) so that future operations
* are fast, if there is any. Returns whether all currently-available work is done. This can
* be invoked while oversized, but oversized graphs will be skipped by this call. */
virtual bool DoWork(uint64_t iters) noexcept = 0;
virtual bool DoWork(uint64_t max_cost) noexcept = 0;
/** Create a staging graph (which cannot exist already). This acts as if a full copy of
* the transaction graph is made, upon which further modifications are made. This copy can
@@ -257,7 +257,7 @@ public:
* and on the sum of transaction sizes within a cluster.
*
* - max_cluster_count cannot exceed MAX_CLUSTER_COUNT_LIMIT.
* - acceptable_iters controls how many linearization optimization steps will be performed per
* - acceptable_cost controls how much linearization optimization work will be performed per
* cluster before they are considered to be of acceptable quality.
* - fallback_order determines how to break tie-breaks between transactions:
* fallback_order(a, b) < 0 means a is "better" than b, and will (in case of ties) be placed
@@ -266,7 +266,7 @@ public:
std::unique_ptr<TxGraph> MakeTxGraph(
unsigned max_cluster_count,
uint64_t max_cluster_size,
uint64_t acceptable_iters,
uint64_t acceptable_cost,
const std::function<std::strong_ordering(const TxGraph::Ref&, const TxGraph::Ref&)>& fallback_order
) noexcept;