Skip to content

Commit 95fe477

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23693: Revert "Fixes Bug in Transaction generation in ComplexMempool benchmark"
faa185b Revert "Fixes Bug in Transaction generation in ComplexMempool benchmark" (MarcoFalke) Pull request description: Developers are reporting crashes (potentially OOM) on IRC, but I can't reproduce. Still, revert this for now, since one developer reported the bare metal this was running on crashed. Top commit has no ACKs. Tree-SHA512: 080db4fcfc682b68f4cc40dfabd9d3e0e3f6e6297ce4b782d5de2c83bc18f85f60efb1cda64c51e23c4fd2a05222a904e7a11853d9f9c052dcd26a53aa00b235
2 parents 6db7e43 + faa185b commit 95fe477

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/bench/mempool_stress.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static std::vector<CTransactionRef> CreateOrderedCoins(FastRandomContext& det_ra
5151
size_t n_ancestors = det_rand.randrange(10)+1;
5252
for (size_t ancestor = 0; ancestor < n_ancestors && !available_coins.empty(); ++ancestor){
5353
size_t idx = det_rand.randrange(available_coins.size());
54-
Available& coin = available_coins[idx];
54+
Available coin = available_coins[idx];
5555
uint256 hash = coin.ref->GetHash();
5656
// biased towards taking min_ancestors parents, but maybe more
5757
size_t n_to_take = det_rand.randrange(2) == 0 ?
@@ -63,17 +63,15 @@ static std::vector<CTransactionRef> CreateOrderedCoins(FastRandomContext& det_ra
6363
tx.vin.back().scriptSig = CScript() << coin.tx_count;
6464
tx.vin.back().scriptWitness.stack.push_back(CScriptNum(coin.tx_count).getvch());
6565
}
66-
if (coin.vin_left == coin.ref->vout.size()) {
67-
if(available_coins.size()-1!=idx){ // if idx is not the last index swap it with the end index
68-
std::swap(available_coins[idx], available_coins.back());
69-
}
66+
if (coin.vin_left == coin.ref->vin.size()) {
67+
coin = available_coins.back();
7068
available_coins.pop_back();
7169
}
72-
}
73-
tx.vout.resize(det_rand.randrange(10)+2);
74-
for (auto& out : tx.vout) {
75-
out.scriptPubKey = CScript() << CScriptNum(tx_counter) << OP_EQUAL;
76-
out.nValue = 10 * COIN;
70+
tx.vout.resize(det_rand.randrange(10)+2);
71+
for (auto& out : tx.vout) {
72+
out.scriptPubKey = CScript() << CScriptNum(tx_counter) << OP_EQUAL;
73+
out.nValue = 10 * COIN;
74+
}
7775
}
7876
ordered_coins.emplace_back(MakeTransactionRef(tx));
7977
available_coins.emplace_back(ordered_coins.back(), tx_counter++);

0 commit comments

Comments
 (0)