Fixed common block detection

This commit is contained in:
arkpar 2016-03-11 18:50:29 +01:00
parent 3250e36b4a
commit 7ad7996144

View File

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