From 1602906b565aecbebbb3b221255663ad68ffb7d9 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 22 Jun 2016 21:37:29 +0200 Subject: [PATCH] Shortcut SF condition when canon known --- ethcore/src/client/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ethcore/src/client/mod.rs b/ethcore/src/client/mod.rs index 589b65e16..3ed56573a 100644 --- a/ethcore/src/client/mod.rs +++ b/ethcore/src/client/mod.rs @@ -228,6 +228,11 @@ pub trait BlockChainClient : Sync + Send { /// Get `Some` gas limit of block 1_760_000, or `None` if chain is not yet that long. fn dao_rescue_block_gas_limit(&self, chain_hash: H256) -> Option { + // shortcut if the canon chain is already known. + if self.chain_info().best_block_number > 1_761_000 { + return self.block_header(BlockID::Number(1_760_000)).map(|header| HeaderView::new(&header).gas_limit()); + } + // otherwise check according to `chain_hash`. if let Some(mut header) = self.block_header(BlockID::Hash(chain_hash)) { if HeaderView::new(&header).number() < 1_760_000 { None