Disaable peer if no common block found

This commit is contained in:
arkpar
2016-11-28 16:30:36 +01:00
parent a7037f8e5b
commit cf5b409fed
3 changed files with 20 additions and 0 deletions

View File

@@ -258,6 +258,12 @@ impl BlockDownloader {
self.blocks.reset_to(hashes);
self.state = State::Blocks;
return Ok(DownloadAction::Reset);
} else {
let best = io.chain().chain_info().best_block_number;
if best > self.last_imported_block && best - self.last_imported_block > MAX_REORG_BLOCKS {
trace!(target: "sync", "No common block, disabling peer");
return Err(BlockDownloaderImportError::Invalid);
}
}
},
State::Blocks => {