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.
This commit is contained in:
woltx
2026-06-08 13:20:15 -07:00
committed by w0xlt
parent 577999c2ce
commit 526aae3768

View File

@@ -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()};