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

Commit

Permalink
Fix is_syncing so it's false as long as the update is trivial. (#1122)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed May 22, 2016
1 parent b53d005 commit c8d2237
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit c8d2237

Please sign in to comment.