From 526aae3768df09b2d39621bc19cd18a388f03e42 Mon Sep 17 00:00:00 2001 From: woltx <94266259+w0xlt@users.noreply.github.com> Date: Mon, 8 Jun 2026 13:20:15 -0700 Subject: [PATCH] fuzz: test non-max descriptor satisfaction weight Also assert that the availability of the satisfaction weight estimate does not depend on the signature-size assumption, and that assuming non-max-size signatures never increases the estimate. --- src/test/fuzz/descriptor_parse.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/fuzz/descriptor_parse.cpp b/src/test/fuzz/descriptor_parse.cpp index 6b3084e23d1..2e73cfcc438 100644 --- a/src/test/fuzz/descriptor_parse.cpp +++ b/src/test/fuzz/descriptor_parse.cpp @@ -55,7 +55,11 @@ static void TestDescriptor(const Descriptor& desc, FlatSigningProvider& sig_prov } const auto max_sat_maxsig{desc.MaxSatisfactionWeight(true)}; - const auto max_sat_nonmaxsig{desc.MaxSatisfactionWeight(true)}; + const auto max_sat_nonmaxsig{desc.MaxSatisfactionWeight(false)}; + // Whether an estimate is available must not depend on the signature-size + // assumption, and assuming non-max-size signatures must never increase it. + assert(max_sat_maxsig.has_value() == max_sat_nonmaxsig.has_value()); + assert(max_sat_nonmaxsig <= max_sat_maxsig); const auto max_elems{desc.MaxSatisfactionElems()}; // We must be able to estimate the max satisfaction size for any solvable descriptor (but combo). const bool is_nontop_or_nonsolvable{!*is_solvable || !desc.GetOutputType()};