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