Fixed common block detection

This commit is contained in:
arkpar 2016-03-11 18:50:29 +01:00
parent 3250e36b4a
commit 7ad7996144
1 changed files with 8 additions and 4 deletions

View File

@ -377,10 +377,14 @@ impl ChainSync {
let hash = info.hash();
match io.chain().block_status(BlockId::Hash(hash.clone())) {
BlockStatus::InChain => {
self.have_common_block = true;
self.last_imported_block = Some(number);
self.last_imported_hash = Some(hash.clone());
trace!(target: "sync", "Found common header {} ({})", number, hash);
if !self.have_common_block {
self.have_common_block = true;
self.last_imported_block = Some(number);
self.last_imported_hash = Some(hash.clone());
trace!(target: "sync", "Found common header {} ({})", number, hash);
} else {
trace!(target: "sync", "Header already in chain {} ({})", number, hash);
}
},
_ => {
if self.have_common_block {