Enforce type consistency in miniscript_stable fuzz test

Add a self-check to the fuzzer that the constructed types match the expected
types in the miniscript_stable fuzzer too.
This commit is contained in:
Pieter Wuille committed 2023-02-28 09:22:42 -05:00
1 parent e1f30414c6
commit 213fffa513
1 file changed
+4 -1
+4 -1
View File
@@ -806,10 +806,13 @@ NodeRef GenNode(F ConsumeNode, Type root_type, bool strict_valid = false) {
node = MakeNodeRef(info.fragment, std::move(info.keys), info.k);
}
// Verify acceptability.
if (!node || !(node->GetType() << type_needed)) {
if (!node || (node->GetType() & "KVWB"_mst) == ""_mst) {
assert(!strict_valid);
return {};
}
if (!(type_needed == ""_mst)) {
assert(node->GetType() << type_needed);
}
if (!node->IsValid()) return {};
// Move it to the stack.
stack.push_back(std::move(node));