Skip to content

Commit 213fffa

Browse files
committed
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.
1 parent e1f3041 commit 213fffa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/fuzz/miniscript.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,10 +806,13 @@ NodeRef GenNode(F ConsumeNode, Type root_type, bool strict_valid = false) {
806806
node = MakeNodeRef(info.fragment, std::move(info.keys), info.k);
807807
}
808808
// Verify acceptability.
809-
if (!node || !(node->GetType() << type_needed)) {
809+
if (!node || (node->GetType() & "KVWB"_mst) == ""_mst) {
810810
assert(!strict_valid);
811811
return {};
812812
}
813+
if (!(type_needed == ""_mst)) {
814+
assert(node->GetType() << type_needed);
815+
}
813816
if (!node->IsValid()) return {};
814817
// Move it to the stack.
815818
stack.push_back(std::move(node));

0 commit comments

Comments
 (0)