Skip to content

Commit

Permalink
Merge bitcoin#20761: fuzz: Check that NULL_DATA is unspendable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MarcoFalke authored and UdjinM6 committed Jul 30, 2023
1 parent 6f7f308 commit a29a0a0
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 @@ -69,6 +69,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 @@ -77,7 +84,6 @@ FUZZ_TARGET_INIT(script, initialize_script)

(void)script.IsPayToScriptHash();
(void)script.IsPushOnly();
(void)script.IsUnspendable();
(void)script.GetSigOpCount(/* fAccurate= */ false);

(void)FormatScript(script);
Expand Down

0 comments on commit a29a0a0

Please sign in to comment.