New sync algorithm

This commit is contained in:
arkpar
2016-05-16 14:41:41 +02:00
parent dfac17538f
commit ca6c91f591
9 changed files with 487 additions and 824 deletions

View File

@@ -233,8 +233,8 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
Params::None => {
let status = take_weak!(self.sync).status();
let res = match status.state {
SyncState::NotSynced | SyncState::Idle => SyncStatus::None,
SyncState::Waiting | SyncState::Blocks | SyncState::NewBlocks => SyncStatus::Info(SyncInfo {
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))

View File

@@ -39,7 +39,7 @@ impl TestSyncProvider {
pub fn new(config: Config) -> Self {
TestSyncProvider {
status: RwLock::new(SyncStatus {
state: SyncState::NotSynced,
state: SyncState::Idle,
network_id: config.network_id,
protocol_version: 63,
start_block_number: 0,