From d7fbeb2c62eaa6d188eca9b9e29f839c0e7f781e Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Tue, 2 Oct 2018 12:09:49 +0800 Subject: [PATCH] fix: no need switching to HeaderSync in FastSync states (#1622) * fix: no need switching to HeaderSync in FastSync states --- servers/src/grin/sync.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/servers/src/grin/sync.rs b/servers/src/grin/sync.rs index b5de1450d..e3e0c4b84 100644 --- a/servers/src/grin/sync.rs +++ b/servers/src/grin/sync.rs @@ -199,8 +199,8 @@ fn do_header_sync( ) { let status = sync_state.status(); - let update_sync_state = match status { - SyncStatus::TxHashsetDownload => false, + let enable_header_sync = match status { + SyncStatus::BodySync { .. } | SyncStatus::HeaderSync { .. } => true, SyncStatus::NoSync | SyncStatus::Initial => { // Reset sync_head to header_head on transition to HeaderSync, // but ONLY on initial transition to HeaderSync state. @@ -217,17 +217,17 @@ fn do_header_sync( history_locators.clear(); true } - _ => true, + _ => false, }; - if update_sync_state { + if enable_header_sync { sync_state.update(SyncStatus::HeaderSync { current_height: header_head.height, highest_height: si.highest_height, }); - } - header_sync(peers, chain, history_locators); + header_sync(peers, chain, history_locators); + } } fn do_fast_sync(