aboutsummaryrefslogtreecommitdiff
path: root/src/bench/mempool_stress.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-07 14:33:42 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-07 14:29:18 +0100
commitfaa185bb3abe5fdaeeae14706bad9437acac6a69 (patch)
tree3fe11061d51b5c515c02ef40d3419a6973baa88f /src/bench/mempool_stress.cpp
parent29e983386b0aecf99cdb7d0e08ba6b450bed313e (diff)
downloadbitcoin-faa185bb3abe5fdaeeae14706bad9437acac6a69.tar.xz
Revert "Fixes Bug in Transaction generation in ComplexMempool benchmark"
This reverts commit 29e983386b0aecf99cdb7d0e08ba6b450bed313e.
Diffstat (limited to 'src/bench/mempool_stress.cpp')
-rw-r--r--src/bench/mempool_stress.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp
index 653a2630fc..f28768efc8 100644
--- a/src/bench/mempool_stress.cpp
+++ b/src/bench/mempool_stress.cpp
@@ -56,7 +56,7 @@ static void ComplexMemPool(benchmark::Bench& bench)
size_t n_ancestors = det_rand.randrange(10)+1;
for (size_t ancestor = 0; ancestor < n_ancestors && !available_coins.empty(); ++ancestor){
size_t idx = det_rand.randrange(available_coins.size());
- Available& coin = available_coins[idx];
+ Available coin = available_coins[idx];
uint256 hash = coin.ref->GetHash();
// biased towards taking just one ancestor, but maybe more
size_t n_to_take = det_rand.randrange(2) == 0 ? 1 : 1+det_rand.randrange(coin.ref->vout.size() - coin.vin_left);
@@ -66,17 +66,15 @@ static void ComplexMemPool(benchmark::Bench& bench)
tx.vin.back().scriptSig = CScript() << coin.tx_count;
tx.vin.back().scriptWitness.stack.push_back(CScriptNum(coin.tx_count).getvch());
}
- if (coin.vin_left == coin.ref->vout.size()) {
- if(available_coins.size()-1!=idx){ // if idx is not the last index swap it with the end index
- std::swap(available_coins[idx], available_coins.back());
- }
+ if (coin.vin_left == coin.ref->vin.size()) {
+ coin = available_coins.back();
available_coins.pop_back();
}
- }
- tx.vout.resize(det_rand.randrange(10)+2);
- for (auto& out : tx.vout) {
- out.scriptPubKey = CScript() << CScriptNum(tx_counter) << OP_EQUAL;
- out.nValue = 10 * COIN;
+ tx.vout.resize(det_rand.randrange(10)+2);
+ for (auto& out : tx.vout) {
+ out.scriptPubKey = CScript() << CScriptNum(tx_counter) << OP_EQUAL;
+ out.nValue = 10 * COIN;
+ }
}
ordered_coins.emplace_back(MakeTransactionRef(tx));
available_coins.emplace_back(ordered_coins.back(), tx_counter++);