mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-08 23:17:23 +02:00
clusterlin tests: count SimpleCandidateFinder iterations better
Only count the number of actual new subsets added. If the queue contains a work item that completely covers a component, no transaction can be added to it without creating a disconnected component. In this case, also don't count it as an iteration. With this, the number of iterations performed by SimpleCandidateFinder is bounded by the number of distinct connected topologically-valid subsets of the cluster.
This commit is contained in:
@@ -64,7 +64,6 @@ public:
|
|||||||
SetInfo best(m_depgraph, m_todo);
|
SetInfo best(m_depgraph, m_todo);
|
||||||
// Process the queue.
|
// Process the queue.
|
||||||
while (!queue.empty() && iterations_left) {
|
while (!queue.empty() && iterations_left) {
|
||||||
--iterations_left;
|
|
||||||
// Pop top element of the queue.
|
// Pop top element of the queue.
|
||||||
auto [inc, und] = queue.back();
|
auto [inc, und] = queue.back();
|
||||||
queue.pop_back();
|
queue.pop_back();
|
||||||
@@ -75,6 +74,7 @@ public:
|
|||||||
// transactions that share ancestry with inc so far (which means only connected
|
// transactions that share ancestry with inc so far (which means only connected
|
||||||
// sets will be considered).
|
// sets will be considered).
|
||||||
if (inc_none || inc.Overlaps(m_depgraph.Ancestors(split))) {
|
if (inc_none || inc.Overlaps(m_depgraph.Ancestors(split))) {
|
||||||
|
--iterations_left;
|
||||||
// Add a queue entry with split included.
|
// Add a queue entry with split included.
|
||||||
SetInfo new_inc(m_depgraph, inc | (m_todo & m_depgraph.Ancestors(split)));
|
SetInfo new_inc(m_depgraph, inc | (m_todo & m_depgraph.Ancestors(split)));
|
||||||
queue.emplace_back(new_inc.transactions, und - new_inc.transactions);
|
queue.emplace_back(new_inc.transactions, und - new_inc.transactions);
|
||||||
|
Reference in New Issue
Block a user