diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 18321d96c..c860264d1 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -125,8 +125,10 @@ impl Chain { Ok(Some(ref tip)) => { // block got accepted and extended the head, updating our head let chain_head = self.head.clone(); - let mut head = chain_head.lock().unwrap(); - *head = tip.clone(); + { + let mut head = chain_head.lock().unwrap(); + *head = tip.clone(); + } self.check_orphans(); } diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index 818ea9ff4..3f7382de6 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -164,10 +164,7 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext) -> Result<(), E /// Fully validate the block content. fn validate_block(b: &Block, ctx: &mut BlockContext) -> Result<(), Error> { if b.header.height > ctx.head.height + 1 { - // check orphan again, an orphan coming out of order from sync will have - // bypassed header checks - // TODO actually handle orphans and add them to a size-limited set - return Err(Error::Unfit("orphan".to_string())); + return Err(Error::Orphan); } let curve = secp::Secp256k1::with_caps(secp::ContextFlag::Commit);