Check queue to determine major importing (#2763)

* simplify major sync detection

* fix typos

* fix merge

* more realistic EthTester

* add new synced state

* remove Blocks synced state

* move is_major_importing to rpc crate and check queue

* add tests
This commit is contained in:
keorn
2016-10-20 22:36:18 +01:00
committed by Gav Wood
parent 236fb82886
commit 866ab9c7a3
13 changed files with 87 additions and 29 deletions

View File

@@ -202,17 +202,6 @@ pub struct SyncStatus {
}
impl SyncStatus {
/// Indicates if initial sync is still in progress.
pub fn is_major_syncing(&self) -> bool {
let is_synced_state = match self.state {
SyncState::Idle | SyncState::NewBlocks | SyncState::Blocks => true,
_ => false,
};
let is_current_block = self.highest_block_number.unwrap_or(self.start_block_number) < self.last_imported_block_number.unwrap_or(0) + BlockNumber::from(4u64);
// If not synced then is major syncing.
!(is_synced_state && is_current_block)
}
/// Indicates if snapshot download is in progress
pub fn is_snapshot_syncing(&self) -> bool {
self.state == SyncState::SnapshotManifest