aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/cryptonote_core.cpp
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2017-08-19 19:36:51 +0100
committerHoward Chu <hyc@symas.com>2017-08-20 16:30:28 +0100
commit9a859844f496158b8237bbd08ff0f608dc5a6385 (patch)
tree01b471ca8a5f334112bd777a10962853aedbffe3 /src/cryptonote_core/cryptonote_core.cpp
parent4c7f8ac04f8693c321f4143e61e7511f200cab1d (diff)
downloadmonzero-core-9a859844f496158b8237bbd08ff0f608dc5a6385.tar.gz
monzero-core-9a859844f496158b8237bbd08ff0f608dc5a6385.tar.xz
monzero-core-9a859844f496158b8237bbd08ff0f608dc5a6385.zip
Toggle SAFE syncmode on and off automatically
If monerod is started with default sync mode, set it to SAFE after synchronization completes. Set it back to FAST if synchronization restarts (e.g. because another peer has a longer blockchain). If monerod is started with an explicit sync mode, none of this automation takes effect.
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 314f37246..a002f19a3 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -316,7 +316,7 @@ namespace cryptonote
const std::string filename = folder.string();
// default to fast:async:1
- blockchain_db_sync_mode sync_mode = db_async;
+ blockchain_db_sync_mode sync_mode = db_defaultsync;
uint64_t blocks_per_sync = 1;
try
@@ -349,11 +349,15 @@ namespace cryptonote
sync_mode = db_nosync;
}
else if(options[0] == "fast")
+ {
db_flags = DBF_FAST;
+ sync_mode = db_async;
+ }
else if(options[0] == "fastest")
{
db_flags = DBF_FASTEST;
blocks_per_sync = 1000; // default to fastest:async:1000
+ sync_mode = db_async;
}
else
db_flags = DEFAULT_FLAGS;