From 8a997a6bb1223358959f9881660670ab4cbf0666 Mon Sep 17 00:00:00 2001 From: BurtonQin Date: Fri, 5 Jun 2020 23:08:53 +0800 Subject: [PATCH] ethcore/light: fix deadlock caused by conflicting lock order --- ethcore/light/src/client/header_chain.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs index d5098db7d7d..5113cbce25f 100644 --- a/ethcore/light/src/client/header_chain.rs +++ b/ethcore/light/src/client/header_chain.rs @@ -823,10 +823,8 @@ impl HeaderChain { /// The header corresponding the the parent hash must be stored already. pub fn epoch_transition_for(&self, parent_hash: H256) -> Option<(Header, Vec)> { // slow path: loop back block by block - let live_proofs = self.live_epoch_proofs.read(); - for hdr in self.ancestry_iter(BlockId::Hash(parent_hash)) { - if let Some(transition) = live_proofs.get(&hdr.hash()).cloned() { + if let Some(transition) = self.live_epoch_proofs.read().get(&hdr.hash()).cloned() { return hdr.decode().map(|decoded_hdr| { (decoded_hdr, transition.proof) }).ok();