@@ -56,22 +56,45 @@ FUZZ_TARGET_INIT(script, initialize_script)
56
56
}
57
57
58
58
CTxDestination address;
59
- (void )ExtractDestination (script, address);
60
-
61
59
TxoutType type_ret;
62
60
std::vector<CTxDestination> addresses;
63
61
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
+ }
72
94
73
95
TxoutType which_type;
74
96
bool is_standard_ret = IsStandard (script, which_type);
97
+ assert (type_ret == which_type);
75
98
if (!is_standard_ret) {
76
99
assert (which_type == TxoutType::NONSTANDARD ||
77
100
which_type == TxoutType::NULL_DATA ||
@@ -88,6 +111,11 @@ FUZZ_TARGET_INIT(script, initialize_script)
88
111
which_type == TxoutType::NONSTANDARD);
89
112
}
90
113
114
+ const FlatSigningProvider signing_provider;
115
+ (void )InferDescriptor (script, signing_provider);
116
+ (void )IsSegWitOutput (signing_provider, script);
117
+ (void )IsSolvable (signing_provider, script);
118
+
91
119
(void )RecursiveDynamicUsage (script);
92
120
93
121
std::vector<std::vector<unsigned char >> solutions;
0 commit comments