Bugfixes: missing == 0 after randrange

This commit is contained in:
Pieter Wuille 2017-06-01 18:28:08 -07:00
parent 7cc2c670e3
commit 9aa215bff9

View file

@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
} }
// One every 10 iterations, remove a random entry from the cache // One every 10 iterations, remove a random entry from the cache
if (insecure_rand() % 10) { if (insecure_rand() % 10 == 0) {
COutPoint out(txids[insecure_rand() % txids.size()], 0); COutPoint out(txids[insecure_rand() % txids.size()], 0);
int cacheid = insecure_rand() % stack.size(); int cacheid = insecure_rand() % stack.size();
stack[cacheid]->Uncache(out); stack[cacheid]->Uncache(out);
@ -422,13 +422,13 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
} }
// One every 10 iterations, remove a random entry from the cache // One every 10 iterations, remove a random entry from the cache
if (utxoset.size() > 1 && insecure_rand() % 30) { if (utxoset.size() > 1 && insecure_rand() % 30 == 0) {
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(utxoset)->first); stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(utxoset)->first);
} }
if (disconnected_coins.size() > 1 && insecure_rand() % 30) { if (disconnected_coins.size() > 1 && insecure_rand() % 30 == 0) {
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(disconnected_coins)->first); stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(disconnected_coins)->first);
} }
if (duplicate_coins.size() > 1 && insecure_rand() % 30) { if (duplicate_coins.size() > 1 && insecure_rand() % 30 == 0) {
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(duplicate_coins)->first); stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(duplicate_coins)->first);
} }