aboutsummaryrefslogtreecommitdiff
path: root/src/test/coins_tests.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2015-11-27 12:05:26 +0100
committerWladimir J. van der Laan <[email protected]>2015-11-27 12:44:00 +0100
commit05d591839fe1fefb0cf359083bce87cb128f75a6 (patch)
tree64370546aae45a75f7af5060d565eef97dbc6bcb /src/test/coins_tests.cpp
parentMerge pull request #7058 (diff)
parentAlter assumptions in CCoinsViewCache::BatchWrite (diff)
downloaddiscoin-05d591839fe1fefb0cf359083bce87cb128f75a6.tar.xz
discoin-05d591839fe1fefb0cf359083bce87cb128f75a6.zip
Merge pull request #5967
072e2f8 Alter assumptions in CCoinsViewCache::BatchWrite (Alex Morcos)
Diffstat (limited to 'src/test/coins_tests.cpp')
-rw-r--r--src/test/coins_tests.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
index 946f904df..9489a19f6 100644
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -165,13 +165,22 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
}
if (insecure_rand() % 100 == 0) {
+ // Every 100 iterations, flush an intermediate cache
+ if (stack.size() > 1 && insecure_rand() % 2 == 0) {
+ unsigned int flushIndex = insecure_rand() % (stack.size() - 1);
+ stack[flushIndex]->Flush();
+ }
+ }
+ if (insecure_rand() % 100 == 0) {
// Every 100 iterations, change the cache stack.
if (stack.size() > 0 && insecure_rand() % 2 == 0) {
+ //Remove the top cache
stack.back()->Flush();
delete stack.back();
stack.pop_back();
}
if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) {
+ //Add a new cache
CCoinsView* tip = &base;
if (stack.size() > 0) {
tip = stack.back();
@@ -305,6 +314,13 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
}
if (insecure_rand() % 100 == 0) {
+ // Every 100 iterations, flush an intermediate cache
+ if (stack.size() > 1 && insecure_rand() % 2 == 0) {
+ unsigned int flushIndex = insecure_rand() % (stack.size() - 1);
+ stack[flushIndex]->Flush();
+ }
+ }
+ if (insecure_rand() % 100 == 0) {
// Every 100 iterations, change the cache stack.
if (stack.size() > 0 && insecure_rand() % 2 == 0) {
stack.back()->Flush();