From 5f92ebee0d2401d0d7b5c3466d66a4b09e51ccb0 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 25 Sep 2024 22:29:46 -0400 Subject: [PATCH] clusterlin tests: compare with fuzz-provided topological sets --- src/test/fuzz/cluster_linearize.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/fuzz/cluster_linearize.cpp b/src/test/fuzz/cluster_linearize.cpp index 4c7906a8b26..628f00f1aea 100644 --- a/src/test/fuzz/cluster_linearize.cpp +++ b/src/test/fuzz/cluster_linearize.cpp @@ -707,6 +707,10 @@ FUZZ_TARGET(clusterlin_simple_finder) auto exhaustive = exh_finder.FindCandidateSet(); assert(exhaustive.feerate == found.feerate); } + + // Compare with a topological set read from the fuzz input. + auto read_topo = ReadTopologicalSet(depgraph, todo, reader); + if (read_topo.Any()) assert(found.feerate >= depgraph.FeeRate(read_topo)); } // Find a topologically valid subset of transactions to remove from the graph. @@ -807,6 +811,10 @@ FUZZ_TARGET(clusterlin_search_finder) // Compare with AncestorCandidateFinder; auto anc = anc_finder.FindCandidateSet(); assert(found.feerate >= anc.feerate); + + // Compare with a topological set read from the fuzz input. + auto read_topo = ReadTopologicalSet(depgraph, todo, reader); + if (read_topo.Any()) assert(found.feerate >= depgraph.FeeRate(read_topo)); } // Find a topologically valid subset of transactions to remove from the graph.