Removed tight restrictions of blocks sync. Sped up initial sync a lot.

pull/170/head v0.6.9
Revertron 3 years ago
parent d502b6c890
commit 66242464c4

@ -40,8 +40,8 @@ pub const UI_REFRESH_DELAY_MS: u128 = 500;
pub const LOG_REFRESH_DELAY_SEC: u64 = 60;
pub const POLL_TIMEOUT: Option<Duration> = Some(Duration::from_millis(500));
/// We start syncing blocks only when we got 8 and more connected nodes
pub const MIN_CONNECTED_NODES_START_SYNC: usize = 8;
/// We start syncing blocks only when we got 4 and more connected nodes
pub const MIN_CONNECTED_NODES_START_SYNC: usize = 4;
pub const MAX_RECONNECTS: u32 = 5;
pub const MAX_IDLE_SECONDS: u64 = 180;
pub const MAX_NODES: usize = 15;

@ -282,7 +282,7 @@ impl Peers {
// If someone has more blocks we sync
if nodes >= MIN_CONNECTED_NODES_START_SYNC {
if height < max_height {
let count = min(max_height - height, (nodes - 5) as u64);
let count = min(max_height - height, nodes as u64);
self.ask_blocks_from_peers(registry, height, height + count, have_blocks);
}
}

Loading…
Cancel
Save