clusterlin: Make IsAcyclic() a DepGraph member function

... instead of being a separate test-only function.

Also add a fuzz test for it returning false.
This commit is contained in:
Pieter Wuille
2024-11-12 15:13:58 -05:00
parent 0aa874a357
commit bfeb69f6e0
3 changed files with 43 additions and 15 deletions

View File

@@ -309,6 +309,17 @@ public:
return a < b;
});
}
/** Check if this graph is acyclic. */
bool IsAcyclic() const noexcept
{
for (auto i : Positions()) {
if ((Ancestors(i) & Descendants(i)) != SetType::Singleton(i)) {
return false;
}
}
return true;
}
};
/** A set of transactions together with their aggregate feerate. */