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)
205205
206206 tx_mut.vin .push_back (in);
207207 }
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+
208220 const auto amount_fee = fuzzed_data_provider.ConsumeIntegralInRange <CAmount>(0 , amount_in);
209221 const auto amount_out = (amount_in - amount_fee) / num_out;
210222 for (int i = 0 ; i < num_out; ++i) {
@@ -215,7 +227,8 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
215227 // Restore previously removed outpoints, except in-package outpoints
216228 if (!last_tx) {
217229 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);
219232 }
220233 // Cache the in-package outpoints being made
221234 for (size_t i = 0 ; i < tx->vout .size (); ++i) {
You can’t perform that action at this time.
0 commit comments