File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,18 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
205
205
206
206
tx_mut.vin .push_back (in);
207
207
}
208
+
209
+ // Duplicate an input
210
+ bool dup_input = fuzzed_data_provider.ConsumeBool ();
211
+ if (dup_input) {
212
+ tx_mut.vin .push_back (tx_mut.vin .back ());
213
+ }
214
+
215
+ // Refer to a non-existant input
216
+ if (fuzzed_data_provider.ConsumeBool ()) {
217
+ tx_mut.vin .emplace_back ();
218
+ }
219
+
208
220
const auto amount_fee = fuzzed_data_provider.ConsumeIntegralInRange <CAmount>(0 , amount_in);
209
221
const auto amount_out = (amount_in - amount_fee) / num_out;
210
222
for (int i = 0 ; i < num_out; ++i) {
@@ -215,7 +227,8 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
215
227
// Restore previously removed outpoints, except in-package outpoints
216
228
if (!last_tx) {
217
229
for (const auto & in : tx->vin ) {
218
- Assert (outpoints.insert (in.prevout ).second );
230
+ // It's a fake input, or a new input, or a duplicate
231
+ Assert (in == CTxIn () || outpoints.insert (in.prevout ).second || dup_input);
219
232
}
220
233
// Cache the in-package outpoints being made
221
234
for (size_t i = 0 ; i < tx->vout .size (); ++i) {
You can’t perform that action at this time.
0 commit comments