fix verification in ethcore-sync collect_blocks (#9135)

This commit is contained in:
Marek Kotewicz 2018-07-16 21:05:47 +02:00 committed by Afri Schoedon
parent 5059619947
commit 0ca4250bd4
1 changed files with 8 additions and 7 deletions

View File

@ -477,18 +477,19 @@ impl BlockDownloader {
for block_and_receipts in blocks {
let block = block_and_receipts.block;
let receipts = block_and_receipts.receipts;
// Perform basic block verification
if !Block::is_good(&block) {
debug!(target: "sync", "Bad block rlp: {:?}", block);
bad = true;
break;
}
let (h, number, parent) = {
let header = view!(BlockView, &block).header_view();
(header.hash(), header.number(), header.parent_hash())
};
// Perform basic block verification
if !Block::is_good(&block) {
debug!(target: "sync", "Bad block rlp {:?} : {:?}", h, block);
bad = true;
break;
}
if self.target_hash.as_ref().map_or(false, |t| t == &h) {
self.state = State::Complete;
trace!(target: "sync", "Sync target reached");