From 213fffa5138229eac2d4a9eda0f643fe90870378 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 25 Feb 2023 15:35:43 -0500 Subject: [PATCH] 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. --- src/test/fuzz/miniscript.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/fuzz/miniscript.cpp b/src/test/fuzz/miniscript.cpp index 1e11c3323c6..df55fc04299 100644 --- a/src/test/fuzz/miniscript.cpp +++ b/src/test/fuzz/miniscript.cpp @@ -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));