From b9584b7ec9c028057ca3008ea421d9f419c00e0a Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 16 Mar 2016 18:25:32 +0100 Subject: [PATCH] restart sync on getting old unknown header --- sync/src/chain.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 8f0194289..4f6c2100a 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -402,6 +402,12 @@ impl ChainSync { debug!(target: "sync", "Mismatched block header {}", number + 1); self.remove_downloaded_blocks(number + 1); } + if self.have_common_block && number < self.current_base_block() + 1 { + // unkown header + debug!(target: "sync", "Old block header {:?} ({}) is unknown, restarting sync", hash, number); + self.restart(io); + return Ok(()); + } } let hdr = Header { data: try!(r.at(i)).as_raw().to_vec(),