Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix verification in ethcore-sync collect_blocks (#9135)
Browse files Browse the repository at this point in the history
  • Loading branch information
debris authored and 5chdn committed Jul 16, 2018
1 parent 8b6eb0c commit 984674f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ethcore/sync/src/block_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,19 @@ impl BlockDownloader {
for block_and_receipts in blocks {
let block = block_and_receipts.block;
let receipts = block_and_receipts.receipts;
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);
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())
};

if self.target_hash.as_ref().map_or(false, |t| t == &h) {
self.state = State::Complete;
trace!(target: "sync", "Sync target reached");
Expand Down

0 comments on commit 984674f

Please sign in to comment.