@@ -56,22 +56,45 @@ FUZZ_TARGET_INIT(script, initialize_script)
5656 }
5757
5858 CTxDestination address;
59- (void )ExtractDestination (script, address);
60-
6159 TxoutType type_ret;
6260 std::vector<CTxDestination> addresses;
6361 int required_ret;
64- (void )ExtractDestinations (script, type_ret, addresses, required_ret);
65-
66- const FlatSigningProvider signing_provider;
67- (void )InferDescriptor (script, signing_provider);
68-
69- (void )IsSegWitOutput (signing_provider, script);
70-
71- (void )IsSolvable (signing_provider, script);
62+ bool extract_destinations_ret = ExtractDestinations (script, type_ret, addresses, required_ret);
63+ bool extract_destination_ret = ExtractDestination (script, address);
64+ if (!extract_destinations_ret) {
65+ assert (!extract_destination_ret);
66+ if (type_ret == TxoutType::MULTISIG) {
67+ assert (addresses.empty () && required_ret == 0 );
68+ } else {
69+ assert (type_ret == TxoutType::PUBKEY ||
70+ type_ret == TxoutType::NONSTANDARD ||
71+ type_ret == TxoutType::NULL_DATA);
72+ }
73+ } else {
74+ assert (required_ret >= 1 && required_ret <= 16 );
75+ assert ((unsigned long )required_ret == addresses.size ());
76+ assert (type_ret == TxoutType::MULTISIG || required_ret == 1 );
77+ }
78+ if (type_ret == TxoutType::NONSTANDARD || type_ret == TxoutType::NULL_DATA) {
79+ assert (!extract_destinations_ret);
80+ }
81+ if (!extract_destination_ret) {
82+ assert (type_ret == TxoutType::PUBKEY ||
83+ type_ret == TxoutType::NONSTANDARD ||
84+ type_ret == TxoutType::NULL_DATA ||
85+ type_ret == TxoutType::MULTISIG);
86+ } else {
87+ assert (address == addresses[0 ]);
88+ }
89+ if (type_ret == TxoutType::NONSTANDARD ||
90+ type_ret == TxoutType::NULL_DATA ||
91+ type_ret == TxoutType::MULTISIG) {
92+ assert (!extract_destination_ret);
93+ }
7294
7395 TxoutType which_type;
7496 bool is_standard_ret = IsStandard (script, which_type);
97+ assert (type_ret == which_type);
7598 if (!is_standard_ret) {
7699 assert (which_type == TxoutType::NONSTANDARD ||
77100 which_type == TxoutType::NULL_DATA ||
@@ -88,6 +111,11 @@ FUZZ_TARGET_INIT(script, initialize_script)
88111 which_type == TxoutType::NONSTANDARD);
89112 }
90113
114+ const FlatSigningProvider signing_provider;
115+ (void )InferDescriptor (script, signing_provider);
116+ (void )IsSegWitOutput (signing_provider, script);
117+ (void )IsSolvable (signing_provider, script);
118+
91119 (void )RecursiveDynamicUsage (script);
92120
93121 std::vector<std::vector<unsigned char >> solutions;
0 commit comments