diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-09-01 11:26:58 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-09-01 11:26:58 +0200 |
commit | e33e74a69b409eaec16a976de21a3dc30659e0a2 (patch) | |
tree | 0fe3c28e8c9282a9c204b92a491aafe3f23847e2 | |
parent | Merge pull request #1009 (diff) | |
parent | Show correct amount of days behind/ahead while syncing (diff) | |
download | monero-e33e74a69b409eaec16a976de21a3dc30659e0a2.tar.xz |
Merge pull request #1012
c2941cb Show correct amount of days behind/ahead while syncing (tobiasw2)
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 6f095a76f..81d96d5bf 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -277,8 +277,11 @@ namespace cryptonote m_core.set_target_blockchain_height(static_cast<int64_t>(hshd.current_height)); int64_t diff = static_cast<int64_t>(hshd.current_height) - static_cast<int64_t>(m_core.get_current_blockchain_height()); + int64_t max_block_height = max(static_cast<int64_t>(hshd.current_height),static_cast<int64_t>(m_core.get_current_blockchain_height())); + int64_t last_block_v1 = 1009826; + int64_t diff_v2 = max_block_height > last_block_v1 ? min(abs(diff), max_block_height - last_block_v1) : 0; LOG_PRINT_CCONTEXT_YELLOW("Sync data returned unknown top block: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height - << " [" << std::abs(diff) << " blocks (" << diff / (24 * 60 * 60 / DIFFICULTY_TARGET_V1) << " days) " + << " [" << 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", (is_inital ? LOG_LEVEL_0:LOG_LEVEL_1)); LOG_PRINT_L1("Remote blockchain height: " << hshd.current_height << ", id: " << hshd.top_id); |