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

This commit is contained in:
Gav Wood 2016-05-22 11:47:17 +02:00
parent b53d0050dd
commit c8d2237f0a

View File

@ -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 status = take_weak!(self.sync).status();
let res = match status.state { let res = match status.state {
SyncState::Idle => SyncStatus::None, SyncState::Idle => SyncStatus::None,
SyncState::Waiting | SyncState::Blocks | SyncState::NewBlocks | SyncState::ChainHead => SyncStatus::Info(SyncInfo { SyncState::Waiting | SyncState::Blocks | SyncState::NewBlocks | SyncState::ChainHead => {
starting_block: U256::from(status.start_block_number), let info = SyncInfo {
current_block: U256::from(take_weak!(self.client).chain_info().best_block_number), starting_block: U256::from(status.start_block_number),
highest_block: U256::from(status.highest_block_number.unwrap_or(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) to_value(&res)
} }