Merge #20765: fuzz: check that certain script TxoutType are nonstandard

efaf80e9bb0afeca2955720bfe6c225d7864036b fuzz: check that certain script TxoutType are nonstandard (Michael Dietz)

Pull request description:

  - Every transaction of type NONSTANDARD must not be a standard script
  - The only know types of nonstandard scripts are NONSTANDARD and certain NULL_DATA and MULTISIG scripts

  When reviewing https://github.com/bitcoin/bitcoin/pull/20761 I figured this is very similar and might also be good to have

ACKs for top commit:
  MarcoFalke:
    ACK efaf80e9bb0afeca2955720bfe6c225d7864036b

Tree-SHA512: 6f563ee3104ea9d2633aad95f1d003474bea759d0f22636c37aa91b5536a6ff0800c42447285ca8ed12f1b3699bf781dae1e5e0a3362da578749cd3164a06ea4
This commit is contained in:
MarcoFalke 2021-01-03 18:28:43 +01:00 committed by pasta
parent ecabacd492
commit 2d41bfbab9
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -65,7 +65,15 @@ FUZZ_TARGET_INIT(script, initialize_script)
(void)IsSolvable(signing_provider, script); (void)IsSolvable(signing_provider, script);
TxoutType which_type; TxoutType which_type;
(void)IsStandard(script, which_type); bool is_standard_ret = IsStandard(script, which_type);
if (!is_standard_ret) {
assert(which_type == TxoutType::NONSTANDARD ||
which_type == TxoutType::NULL_DATA ||
which_type == TxoutType::MULTISIG);
}
if (which_type == TxoutType::NONSTANDARD) {
assert(!is_standard_ret);
}
if (which_type == TxoutType::NULL_DATA) { if (which_type == TxoutType::NULL_DATA) {
assert(script.IsUnspendable()); assert(script.IsUnspendable());
} }