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
2023-02-25 15:35:43 -05:00
parent e1f30414c6
commit 213fffa513

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));