Changeset View
Changeset View
Standalone View
Standalone View
src/test/coins_tests.cpp
Show First 20 Lines • Show All 337 Lines • ▼ Show 20 Lines | for (int64_t i = 0; i < NUM_SIMULATION_ITERATIONS; i++) { | ||||
} else { | } else { | ||||
coinbase_coins.insert(COutPoint(tx.GetId(), 0)); | coinbase_coins.insert(COutPoint(tx.GetId(), 0)); | ||||
} | } | ||||
assert(CTransaction(tx).IsCoinBase()); | assert(CTransaction(tx).IsCoinBase()); | ||||
} | } | ||||
// 17/20 times reconnect previous or add a regular tx | // 17/20 times reconnect previous or add a regular tx | ||||
else { | else { | ||||
COutPoint prevout; | COutPoint prevout; | ||||
// 1/20 times reconnect a previously disconnected tx | // 1/20 times reconnect a previously disconnected tx | ||||
if (randiter % 20 == 2 && disconnected_coins.size()) { | if (randiter % 20 == 2 && disconnected_coins.size()) { | ||||
auto utxod = FindRandomFrom(disconnected_coins); | auto utxod = FindRandomFrom(disconnected_coins); | ||||
tx = CMutableTransaction{std::get<0>(utxod->second)}; | tx = CMutableTransaction{std::get<0>(utxod->second)}; | ||||
prevout = tx.vin[0].prevout; | prevout = tx.vin[0].prevout; | ||||
if (!CTransaction(tx).IsCoinBase() && | if (!CTransaction(tx).IsCoinBase() && | ||||
!utxoset.count(prevout)) { | !utxoset.count(prevout)) { | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |