MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / MatchesOversizedClusters

Method MatchesOversizedClusters

src/test/fuzz/txgraph.cpp:281–301  ·  view source on GitHub ↗

Verify that set contains transactions from every oversized cluster, and nothing from * non-oversized ones. */

Source from the content-addressed store, hash-verified

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

Callers 1

FUZZ_TARGETFunction · 0.80

Calls 6

FeeRateMethod · 0.80
AnyMethod · 0.45
IsSubsetOfMethod · 0.45
CountMethod · 0.45
OverlapsMethod · 0.45

Tested by

no test coverage detected