Fix is_syncing so it's false as long as the update is trivial. (#1122)
This commit is contained in:
parent
b53d0050dd
commit
c8d2237f0a
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user