From 94302f3f610f0d1cd3ff08ae25d6663fce4afb2d Mon Sep 17 00:00:00 2001 From: keorn Date: Mon, 5 Dec 2016 15:27:44 +0000 Subject: [PATCH] throw out difficulty checks --- ethcore/src/engines/authority_round.rs | 5 ----- ethcore/src/ethereum/ethash.rs | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/ethcore/src/engines/authority_round.rs b/ethcore/src/engines/authority_round.rs index c278a011a..f28a06117 100644 --- a/ethcore/src/engines/authority_round.rs +++ b/ethcore/src/engines/authority_round.rs @@ -274,7 +274,6 @@ impl Engine for AuthorityRound { } fn verify_block_family(&self, header: &Header, parent: &Header, _block: Option<&[u8]>) -> Result<(), Error> { - // Don't calculate difficulty for genesis blocks. if header.number() == 0 { return Err(From::from(BlockError::RidiculousNumber(OutOfBounds { min: Some(1), max: None, found: header.number() }))); } @@ -286,10 +285,6 @@ impl Engine for AuthorityRound { try!(Err(BlockError::DoubleVote(header.author().clone()))); } - // Check difficulty is correct given the two timestamps. - if header.difficulty() != parent.difficulty() { - return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: *parent.difficulty(), found: *header.difficulty() }))) - } let gas_limit_divisor = self.our_params.gas_limit_bound_divisor; let min_gas = parent.gas_limit().clone() - parent.gas_limit().clone() / gas_limit_divisor; let max_gas = parent.gas_limit().clone() + parent.gas_limit().clone() / gas_limit_divisor; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 0ca9ff00e..96c1298cc 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -328,12 +328,12 @@ impl Engine for Ethash { t.sender().map(|_|()) // Perform EC recovery and cache sender } - /// Check if a new block should replace the best blockchain block. fn is_new_best_block(&self, best_total_difficulty: U256, _best_header: HeaderView, parent_details: &BlockDetails, new_header: &HeaderView) -> bool { is_new_best_block(best_total_difficulty, parent_details, new_header) } } +/// Check if a new block should replace the best blockchain block. pub fn is_new_best_block(best_total_difficulty: U256, parent_details: &BlockDetails, new_header: &HeaderView) -> bool { parent_details.total_difficulty + new_header.difficulty() > best_total_difficulty }