Skip to content

Commit

Permalink
[chain] Fix uncle block header verify bug when epoch change. (#1686)
Browse files Browse the repository at this point in the history
Co-authored-by: tiangong3624749 <tiangong3624749@163.com>
  • Loading branch information
jolestar and tiangong3624749 authored Nov 20, 2020
1 parent a04cf4d commit a8d9eff
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
} {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit a8d9eff

Please sign in to comment.