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

Fix Goerli syncing #11604

Merged
merged 1 commit into from
Apr 10, 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
17 changes: 15 additions & 2 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ impl Importer {
let start = Instant::now();

for (block, block_bytes) in blocks {
// Some engines may change the header such that the header hash
// is different in the LockedBlock from what it was in the
// PreverifiedBlock. When committing the block we need the
// header from the Preverified block and not the one from the
// LockedBlock. See https://github.com/openethereum/openethereum/issues/11603
let preverified_header = block.header.clone();
let hash = block.header.hash();

let is_invalid = invalid_blocks.contains(block.header.parent_hash());
Expand All @@ -310,7 +316,13 @@ impl Importer {
imported_blocks.push(hash);
let transactions_len = locked_block.transactions.len();
let gas_used = *locked_block.header.gas_used();
let route = self.commit_block(locked_block, encoded::Block::new(block_bytes), pending, client);
let route = self.commit_block(
locked_block,
&preverified_header,
encoded::Block::new(block_bytes),
pending,
client
);
import_results.push(route);
client.report.write().accrue_block(gas_used, transactions_len);
}
Expand Down Expand Up @@ -488,14 +500,14 @@ impl Importer {
fn commit_block<B>(
&self,
block: B,
header: &Header,
block_data: encoded::Block,
pending: Option<PendingTransition>,
client: &Client
) -> ImportRoute
where B: Drain
{
let block = block.drain();
let header = block.header;
let hash = &header.hash();
let number = header.number();
let parent = header.parent_hash();
Expand Down Expand Up @@ -2412,6 +2424,7 @@ impl ImportSealedBlock for Client {
)?;
let route = self.importer.commit_block(
block,
&header,
encoded::Block::new(block_bytes),
pending,
self
Expand Down