aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2023-02-25 15:35:43 -0500
committerPieter Wuille <pieter@wuille.net>2023-02-28 09:22:42 -0500
commit213fffa5138229eac2d4a9eda0f643fe90870378 (patch)
tree80171d971dbdbe2e8a34344d2fe7d2459521cdd1 /src/test/fuzz
parente1f30414c6b9434048e089ccc3ec4f475f980c60 (diff)
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.
Diffstat (limited to 'src/test/fuzz')
-rw-r--r--src/test/fuzz/miniscript.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/fuzz/miniscript.cpp b/src/test/fuzz/miniscript.cpp
index 1e11c3323c..df55fc0429 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));