Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
11 changes: 6 additions & 5 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2165,11 +2165,8 @@ impl IoClient for Client {
// NOTE To prevent race condition with import, make sure to check queued blocks first
// (and attempt to acquire lock)
let is_parent_pending = self.queued_ancient_blocks.read().0.contains(&parent_hash);
if !is_parent_pending {
let status = self.block_status(BlockId::Hash(parent_hash));
if status == BlockStatus::Unknown {
bail!(EthcoreErrorKind::Block(BlockError::UnknownParent(parent_hash)));
}
if !is_parent_pending && !self.chain.read().is_known(&parent_hash) {
bail!(EthcoreErrorKind::Block(BlockError::UnknownParent(parent_hash)));
}
}

Expand Down Expand Up @@ -2199,6 +2196,10 @@ impl IoClient for Client {
);
if let Err(e) = result {
error!(target: "client", "Error importing ancient block: {}", e);

let mut queued = queued.write();
queued.0.clear();
queued.1.clear();
Comment thread
ascjones marked this conversation as resolved.
}
// remove from pending
queued.write().0.remove(&hash);
Expand Down