Skip to content

Commit 9aa215b

Browse files
committed
Bugfixes: missing == 0 after randrange
1 parent 7cc2c67 commit 9aa215b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/coins_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
173173
}
174174

175175
// One every 10 iterations, remove a random entry from the cache
176-
if (insecure_rand() % 10) {
176+
if (insecure_rand() % 10 == 0) {
177177
COutPoint out(txids[insecure_rand() % txids.size()], 0);
178178
int cacheid = insecure_rand() % stack.size();
179179
stack[cacheid]->Uncache(out);
@@ -422,13 +422,13 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
422422
}
423423

424424
// One every 10 iterations, remove a random entry from the cache
425-
if (utxoset.size() > 1 && insecure_rand() % 30) {
425+
if (utxoset.size() > 1 && insecure_rand() % 30 == 0) {
426426
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(utxoset)->first);
427427
}
428-
if (disconnected_coins.size() > 1 && insecure_rand() % 30) {
428+
if (disconnected_coins.size() > 1 && insecure_rand() % 30 == 0) {
429429
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(disconnected_coins)->first);
430430
}
431-
if (duplicate_coins.size() > 1 && insecure_rand() % 30) {
431+
if (duplicate_coins.size() > 1 && insecure_rand() % 30 == 0) {
432432
stack[insecure_rand() % stack.size()]->Uncache(FindRandomFrom(duplicate_coins)->first);
433433
}
434434

0 commit comments

Comments
 (0)