@@ -217,11 +217,10 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
217
217
std::vector<CTransactionRef> txs;
218
218
219
219
// Find something we may want to double-spend with two input single tx
220
- std::optional<COutPoint> outpoint_to_rbf{GetChildEvictingPrevout (tx_pool)};
221
- bool should_rbf_eph_spend = outpoint_to_rbf && fuzzed_data_provider.ConsumeBool ();
220
+ std::optional<COutPoint> outpoint_to_rbf{fuzzed_data_provider.ConsumeBool () ? GetChildEvictingPrevout (tx_pool) : std::nullopt};
222
221
223
222
// Make small packages
224
- const auto num_txs = should_rbf_eph_spend ? 1 : (size_t ) fuzzed_data_provider.ConsumeIntegralInRange <int >(1 , 4 );
223
+ const auto num_txs = outpoint_to_rbf ? 1 : (size_t ) fuzzed_data_provider.ConsumeIntegralInRange <int >(1 , 4 );
225
224
226
225
std::set<COutPoint> package_outpoints;
227
226
while (txs.size () < num_txs) {
@@ -237,10 +236,10 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
237
236
tx_mut.version = CTransaction::CURRENT_VERSION;
238
237
tx_mut.nLockTime = 0 ;
239
238
// Last tx will sweep half or more of all outpoints from package
240
- const auto num_in = should_rbf_eph_spend ? 2 :
239
+ const auto num_in = outpoint_to_rbf ? 2 :
241
240
last_tx ? fuzzed_data_provider.ConsumeIntegralInRange <int >(package_outpoints.size ()/2 + 1 , package_outpoints.size ()) :
242
241
fuzzed_data_provider.ConsumeIntegralInRange <int >(1 , 4 );
243
- auto num_out = should_rbf_eph_spend ? 1 : fuzzed_data_provider.ConsumeIntegralInRange <int >(1 , 4 );
242
+ const auto num_out = outpoint_to_rbf ? 1 : fuzzed_data_provider.ConsumeIntegralInRange <int >(1 , 4 );
244
243
245
244
auto & outpoints = last_tx ? package_outpoints : mempool_outpoints;
246
245
@@ -254,7 +253,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
254
253
std::advance (pop, fuzzed_data_provider.ConsumeIntegralInRange <size_t >(0 , outpoints.size () - 1 ));
255
254
auto outpoint = *pop;
256
255
257
- if (i == 0 && should_rbf_eph_spend ) {
256
+ if (i == 0 && outpoint_to_rbf ) {
258
257
outpoint = *outpoint_to_rbf;
259
258
outpoints.erase (outpoint);
260
259
} else {
@@ -278,7 +277,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
278
277
}
279
278
280
279
// Note output amounts can naturally drop to dust on their own.
281
- if (!should_rbf_eph_spend && fuzzed_data_provider.ConsumeBool ()) {
280
+ if (!outpoint_to_rbf && fuzzed_data_provider.ConsumeBool ()) {
282
281
uint32_t dust_index = fuzzed_data_provider.ConsumeIntegralInRange <uint32_t >(0 , num_out);
283
282
tx_mut.vout .insert (tx_mut.vout .begin () + dust_index, CTxOut (0 , P2WSH_EMPTY));
284
283
}
0 commit comments