txgraph: Add CountDistinctClusters function (feature)

This commit is contained in:
Pieter Wuille
2025-01-16 16:00:10 -05:00
parent b685d322c9
commit aded047019
3 changed files with 77 additions and 0 deletions

View File

@@ -149,6 +149,11 @@ public:
/** Compare two transactions according to their order in the main graph. Both transactions must
* be in the main graph. The main graph must not be oversized. */
virtual std::strong_ordering CompareMainOrder(const Ref& a, const Ref& b) noexcept = 0;
/** Count the number of distinct clusters that the specified transactions belong to. If
* main_only is false and a staging graph exists, staging clusters are counted. Otherwise,
* main clusters are counted. Refs that do not exist in the queried graph are ignored. The
* queried graph must not be oversized. */
virtual GraphIndex CountDistinctClusters(std::span<const Ref* const>, bool main_only = false) noexcept = 0;
/** Perform an internal consistency check on this object. */
virtual void SanityCheck() const = 0;