Skip to content

Commit fa26303

Browse files
author
MarcoFalke
committed
fuzz: Check that NULL_DATA is unspendable
1 parent 1be6f2d commit fa26303

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)