Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Fix is_syncing so it's false as long as the update is trivial. #1122

Merged
merged 1 commit into from
May 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions rpc/src/v1/impls/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,17 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
let status = take_weak!(self.sync).status();
let res = match status.state {
SyncState::Idle => SyncStatus::None,
SyncState::Waiting | SyncState::Blocks | SyncState::NewBlocks | SyncState::ChainHead => SyncStatus::Info(SyncInfo {
starting_block: U256::from(status.start_block_number),
current_block: U256::from(take_weak!(self.client).chain_info().best_block_number),
highest_block: U256::from(status.highest_block_number.unwrap_or(status.start_block_number))
})
SyncState::Waiting | SyncState::Blocks | SyncState::NewBlocks | SyncState::ChainHead => {
let info = SyncInfo {
starting_block: U256::from(status.start_block_number),
current_block: U256::from(take_weak!(self.client).chain_info().best_block_number),
highest_block: U256::from(status.highest_block_number.unwrap_or(status.start_block_number))
};
match info.highest_block > info.starting_block + U256::from(6) {
true => SyncStatus::Info(info),
false => SyncStatus::None,
}
}
};
to_value(&res)
}
Expand Down