From a8d9eff01cc41ef5462e0bf81fd8ae0f7916b111 Mon Sep 17 00:00:00 2001 From: jolestar Date: Fri, 20 Nov 2020 17:12:22 +0800 Subject: [PATCH] [chain] Fix uncle block header verify bug when epoch change. (#1686) Co-authored-by: tiangong3624749 --- chain/src/chain.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/chain/src/chain.rs b/chain/src/chain.rs index ab56336cde..48efd30c50 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -764,11 +764,12 @@ impl BlockChain { } let consensus = epoch.epoch().strategy(); - // TODO 最小值是否需要 if let Err(err) = if is_uncle { let uncle_branch = BlockChain::new(self.time_service(), parent_hash, self.storage.clone())?; - consensus.verify(&uncle_branch, epoch, header) + //TODO get epoch in consensus.verify + let uncle_epoch = uncle_branch.epoch_info()?; + consensus.verify(&uncle_branch, &uncle_epoch, header) } else { consensus.verify(self, epoch, header) } { @@ -945,13 +946,6 @@ impl BlockChain { header.parent_block_accumulator_root(), ); - verify_block!( - VerifyBlockField::Header, - block.body.hash() == header.body_hash(), - "verify block:{:?} body hash fail.", - header.id(), - ); - if header.number() == epoch_info.end_block_number() { switch_epoch = true; }