Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chain] Fix uncle block header verify bug when epoch change. #1686

Merged
merged 2 commits into from
Nov 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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