Skip to content

Commit 443988d

Browse files
author
MarcoFalke
committed
Merge #20761: fuzz: Check that NULL_DATA is unspendable
fa26303 fuzz: Check that NULL_DATA is unspendable (MarcoFalke) Pull request description: * Every script of type NULL_DATA must be unspendable * The only know types of unspendable scripts are NULL_DATA and certain NONSTANDARD scripts ACKs for top commit: sipa: utACK fa26303 Tree-SHA512: 8297fbacf32b4868b12accc1c052d352d02d96540a1fc883de9d04a3df8734116deecc33046495c9a3af6d79fec7f8d63afbfa5e401a2ca8d7c70f0f13735c0d
2 parents 1b31695 + fa26303 commit 443988d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test/fuzz/script.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ FUZZ_TARGET_INIT(script, initialize_script)
7272

7373
TxoutType which_type;
7474
(void)IsStandard(script, which_type);
75+
if (which_type == TxoutType::NULL_DATA) {
76+
assert(script.IsUnspendable());
77+
}
78+
if (script.IsUnspendable()) {
79+
assert(which_type == TxoutType::NULL_DATA ||
80+
which_type == TxoutType::NONSTANDARD);
81+
}
7582

7683
(void)RecursiveDynamicUsage(script);
7784

@@ -82,7 +89,6 @@ FUZZ_TARGET_INIT(script, initialize_script)
8289
(void)script.IsPayToScriptHash();
8390
(void)script.IsPayToWitnessScriptHash();
8491
(void)script.IsPushOnly();
85-
(void)script.IsUnspendable();
8692
(void)script.GetSigOpCount(/* fAccurate= */ false);
8793

8894
(void)FormatScript(script);

0 commit comments

Comments
 (0)