Skip to content

Commit

Permalink
fuzz: Check that NULL_DATA is unspendable
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Dec 24, 2020
1 parent 1be6f2d commit fa26303
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test/fuzz/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ FUZZ_TARGET_INIT(script, initialize_script)

TxoutType which_type;
(void)IsStandard(script, which_type);
if (which_type == TxoutType::NULL_DATA) {
assert(script.IsUnspendable());
}
if (script.IsUnspendable()) {
assert(which_type == TxoutType::NULL_DATA ||
which_type == TxoutType::NONSTANDARD);
}

(void)RecursiveDynamicUsage(script);

Expand All @@ -82,7 +89,6 @@ FUZZ_TARGET_INIT(script, initialize_script)
(void)script.IsPayToScriptHash();
(void)script.IsPayToWitnessScriptHash();
(void)script.IsPushOnly();
(void)script.IsUnspendable();
(void)script.GetSigOpCount(/* fAccurate= */ false);

(void)FormatScript(script);
Expand Down

0 comments on commit fa26303

Please sign in to comment.