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