aboutsummaryrefslogtreecommitdiff
path: root/src/test/util
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-03-30 20:07:04 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-03-30 20:07:53 +0200
commit267b60f800cb298d6700ae54fdace595c0e80313 (patch)
tree8d6db85b07895b10e8c9b8508e7f057705548f5f /src/test/util
parentf9e86d89660002d3dd17211d8b030a47b95d2fa2 (diff)
parentfa4926cca68db2433e579d9b4a642248a9314673 (diff)
Merge #21553: fuzz: Misc refactor
fa4926cca68db2433e579d9b4a642248a9314673 fuzz: [refactor] Use IsValidFlagCombination in signature_checker fuzz target (MarcoFalke) eeee8f5be1d4ccfb7e237248be5c6bef45b0fbb8 fuzz: Removed unused try-catch in coins_view (MarcoFalke) fa98f3f66ecb0a0c6805dcdcf828f12a1a11c3e6 fuzz: [refactor] Use ConsumeScript in signature_checker fuzz target (MarcoFalke) Pull request description: Some small refactors to remove unused and redundant fuzz code ACKs for top commit: practicalswift: cr re-ACK fa4926cca68db2433e579d9b4a642248a9314673 Tree-SHA512: eb07a2140caad7b31495b76385fc7634cf5b6daa4947f430ebb127eb1375583dc11e541a0a42d0e5d93d430480b8a815b93974450fd5ed897528a2d47c752f86
Diffstat (limited to 'src/test/util')
-rw-r--r--src/test/util/script.cpp13
-rw-r--r--src/test/util/script.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/src/test/util/script.cpp b/src/test/util/script.cpp
new file mode 100644
index 0000000000..a5852daa60
--- /dev/null
+++ b/src/test/util/script.cpp
@@ -0,0 +1,13 @@
+// Copyright (c) 2021 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <script/interpreter.h>
+#include <test/util/script.h>
+
+bool IsValidFlagCombination(unsigned flags)
+{
+ if (flags & SCRIPT_VERIFY_CLEANSTACK && ~flags & (SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS)) return false;
+ if (flags & SCRIPT_VERIFY_WITNESS && ~flags & SCRIPT_VERIFY_P2SH) return false;
+ return true;
+}
diff --git a/src/test/util/script.h b/src/test/util/script.h
index abd14c2067..428b3e10b3 100644
--- a/src/test/util/script.h
+++ b/src/test/util/script.h
@@ -18,4 +18,7 @@ static const CScript P2WSH_OP_TRUE{
return hash;
}())};
+/** Flags that are not forbidden by an assert in script validation */
+bool IsValidFlagCombination(unsigned flags);
+
#endif // BITCOIN_TEST_UTIL_SCRIPT_H