aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/descriptor_parse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/fuzz/descriptor_parse.cpp')
-rw-r--r--src/test/fuzz/descriptor_parse.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/fuzz/descriptor_parse.cpp b/src/test/fuzz/descriptor_parse.cpp
index 8ed659323c..26c219d6c8 100644
--- a/src/test/fuzz/descriptor_parse.cpp
+++ b/src/test/fuzz/descriptor_parse.cpp
@@ -112,7 +112,7 @@ static void TestDescriptor(const Descriptor& desc, FlatSigningProvider& sig_prov
{
// Trivial helpers.
(void)desc.IsRange();
- (void)desc.IsSolvable();
+ const bool is_solvable{desc.IsSolvable()};
(void)desc.IsSingleType();
(void)desc.GetOutputType();
@@ -131,7 +131,19 @@ static void TestDescriptor(const Descriptor& desc, FlatSigningProvider& sig_prov
// If we could serialize to script we must be able to infer using the same provider.
if (!out_scripts.empty()) {
assert(InferDescriptor(out_scripts.back(), sig_provider));
+
+ // The ScriptSize() must match the size of the serialized Script. (ScriptSize() is set for all descs but 'combo()'.)
+ const bool is_combo{!desc.IsSingleType()};
+ assert(is_combo || desc.ScriptSize() == out_scripts.back().size());
}
+
+ const auto max_sat_maxsig{desc.MaxSatisfactionWeight(true)};
+ const auto max_sat_nonmaxsig{desc.MaxSatisfactionWeight(true)};
+ 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()};
+ const bool is_input_size_info_set{max_sat_maxsig && max_sat_nonmaxsig && max_elems};
+ assert(is_input_size_info_set || is_nontop_or_nonsolvable);
}
void initialize_descriptor_parse()