@@ -217,11 +217,10 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
217217 std::vector<CTransactionRef> txs;
218218
219219 // 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 };
222221
223222 // 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 );
225224
226225 std::set<COutPoint> package_outpoints;
227226 while (txs.size () < num_txs) {
@@ -237,10 +236,10 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
237236 tx_mut.version = CTransaction::CURRENT_VERSION;
238237 tx_mut.nLockTime = 0 ;
239238 // 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 :
241240 last_tx ? fuzzed_data_provider.ConsumeIntegralInRange <int >(package_outpoints.size ()/2 + 1 , package_outpoints.size ()) :
242241 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 );
244243
245244 auto & outpoints = last_tx ? package_outpoints : mempool_outpoints;
246245
@@ -254,7 +253,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
254253 std::advance (pop, fuzzed_data_provider.ConsumeIntegralInRange <size_t >(0 , outpoints.size () - 1 ));
255254 auto outpoint = *pop;
256255
257- if (i == 0 && should_rbf_eph_spend ) {
256+ if (i == 0 && outpoint_to_rbf ) {
258257 outpoint = *outpoint_to_rbf;
259258 outpoints.erase (outpoint);
260259 } else {
@@ -278,7 +277,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
278277 }
279278
280279 // 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 ()) {
282281 uint32_t dust_index = fuzzed_data_provider.ConsumeIntegralInRange <uint32_t >(0 , num_out);
283282 tx_mut.vout .insert (tx_mut.vout .begin () + dust_index, CTxOut (0 , P2WSH_EMPTY));
284283 }
0 commit comments