aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-05-30 15:46:13 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-05-30 15:46:13 -0500
commita7ea14dc6a561069ca658a2c5343fbb7143996a9 (patch)
treef843d8fc50ec6394255d6b3bf8e60c6a65056eee /src/cryptonote_core
parentMerge pull request #3731 (diff)
parentprotocol: do not switch to unsafe sync mode for just a few blocks (diff)
downloadmonero-a7ea14dc6a561069ca658a2c5343fbb7143996a9.tar.xz
Merge pull request #3876
740da1b core: fix automatic safe db sync mode switching (moneromooo-monero) e942d34 protocol: do not switch to unsafe sync mode for just a few blocks (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index c0d82d556..d2796deeb 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -438,6 +438,7 @@ namespace cryptonote
std::vector<std::string> options;
boost::trim(db_sync_mode);
boost::split(options, db_sync_mode, boost::is_any_of(" :"));
+ const bool db_sync_mode_is_default = command_line::is_arg_defaulted(vm, cryptonote::arg_db_sync_mode);
for(const auto &option : options)
MDEBUG("option: " << option);
@@ -458,18 +459,18 @@ namespace cryptonote
{
safemode = true;
db_flags = DBF_SAFE;
- sync_mode = db_nosync;
+ sync_mode = db_sync_mode_is_default ? db_defaultsync : db_nosync;
}
else if(options[0] == "fast")
{
db_flags = DBF_FAST;
- sync_mode = db_async;
+ sync_mode = db_sync_mode_is_default ? db_defaultsync : db_async;
}
else if(options[0] == "fastest")
{
db_flags = DBF_FASTEST;
blocks_per_sync = 1000; // default to fastest:async:1000
- sync_mode = db_async;
+ sync_mode = db_sync_mode_is_default ? db_defaultsync : db_async;
}
else
db_flags = DEFAULT_FLAGS;
@@ -478,9 +479,9 @@ namespace cryptonote
if(options.size() >= 2 && !safemode)
{
if(options[1] == "sync")
- sync_mode = db_sync;
+ sync_mode = db_sync_mode_is_default ? db_defaultsync : db_sync;
else if(options[1] == "async")
- sync_mode = db_async;
+ sync_mode = db_sync_mode_is_default ? db_defaultsync : db_async;
}
if(options.size() >= 3 && !safemode)