Verify that set contains transactions from every oversized cluster, and nothing from * non-oversized ones. */
| 279 | /** Verify that set contains transactions from every oversized cluster, and nothing from |
| 280 | * non-oversized ones. */ |
| 281 | bool MatchesOversizedClusters(const SetType& set) |
| 282 | { |
| 283 | if (set.Any() && !IsOversized()) return false; |
| 284 | |
| 285 | auto todo = graph.Positions(); |
| 286 | if (!set.IsSubsetOf(todo)) return false; |
| 287 | |
| 288 | // Walk all clusters, and make sure all of set doesn't come from non-oversized clusters |
| 289 | while (todo.Any()) { |
| 290 | auto component = graph.FindConnectedComponent(todo); |
| 291 | // Determine whether component is oversized, due to either the size or count limit. |
| 292 | bool is_oversized = component.Count() > max_cluster_count; |
| 293 | uint64_t component_size{0}; |
| 294 | for (auto i : component) component_size += graph.FeeRate(i).size; |
| 295 | is_oversized |= component_size > max_cluster_size; |
| 296 | // Check whether overlap with set matches is_oversized. |
| 297 | if (is_oversized != set.Overlaps(component)) return false; |
| 298 | todo -= component; |
| 299 | } |
| 300 | return true; |
| 301 | } |
| 302 | }; |
| 303 | |
| 304 | } // namespace |
no test coverage detected