diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-02-21 11:27:49 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-02-21 11:27:49 +0200 |
commit | b252afb0b08e331ccef0b495ca641519810e099b (patch) | |
tree | 8349cef823cb6677ebfac38744d0b599af5de657 /src | |
parent | Merge pull request #1727 (diff) | |
parent | Fix spurious synchronization status msgs (diff) | |
download | monero-b252afb0b08e331ccef0b495ca641519810e099b.tar.xz |
Merge pull request #1736
424b76a4 Fix spurious synchronization status msgs (Howard Chu)
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 31b4d0b87..89f207131 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -265,14 +265,17 @@ namespace cryptonote if(context.m_state == cryptonote_connection_context::state_synchronizing) return true; + uint64_t target = m_core.get_target_blockchain_height(); if(m_core.have_block(hshd.top_id)) { context.m_state = cryptonote_connection_context::state_normal; - if(is_inital) + if(is_inital && target == m_core.get_current_blockchain_height()) on_connection_synchronized(); return true; } + if (hshd.current_height > target) + { /* As I don't know if accessing hshd from core could be a good practice, I prefer pushing target height to the core at the same time it is pushed to the user. Nz. */ @@ -286,6 +289,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"); + } LOG_PRINT_L1("Remote blockchain height: " << hshd.current_height << ", id: " << hshd.top_id); context.m_state = cryptonote_connection_context::state_synchronizing; context.m_remote_blockchain_height = hshd.current_height; |