aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
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_protocol
parentDB cleanup (diff)
downloadmonero-9a859844f496158b8237bbd08ff0f608dc5a6385.tar.xz
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 '')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index daefe88b7..87c02709a 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -295,6 +295,7 @@ namespace cryptonote
<< " [Your node is " << std::abs(diff) << " blocks (" << ((abs(diff) - diff_v2) / (24 * 60 * 60 / DIFFICULTY_TARGET_V1)) + (diff_v2 / (24 * 60 * 60 / DIFFICULTY_TARGET_V2)) << " days) "
<< (0 <= diff ? std::string("behind") : std::string("ahead"))
<< "] " << ENDL << "SYNCHRONIZATION started");
+ m_core.get_blockchain_storage().safesyncmode(false);
}
LOG_PRINT_L1("Remote blockchain height: " << hshd.current_height << ", id: " << hshd.top_id);
context.m_state = cryptonote_connection_context::state_synchronizing;
@@ -1473,6 +1474,7 @@ skip:
<< "**********************************************************************");
m_core.on_synchronized();
}
+ m_core.get_blockchain_storage().safesyncmode(true);
return true;
}
//------------------------------------------------------------------------------------------------------------------------