Fix receipts stripping. (#8414)

This commit is contained in:
Tomasz Drwięga
2018-04-19 11:25:15 +02:00
committed by André Silva
parent 941f2380c4
commit 461b2d4853
2 changed files with 28 additions and 13 deletions

View File

@@ -415,7 +415,6 @@ impl Importer {
let db = client.state_db.read().boxed_clone_canon(header.parent_hash());
let is_epoch_begin = chain.epoch_transition(parent.number(), *header.parent_hash()).is_some();
let strip_receipts = header.number() < engine.params().validate_receipts_transition;
let enact_result = enact_verified(
block,
engine,
@@ -425,13 +424,21 @@ impl Importer {
last_hashes,
client.factories.clone(),
is_epoch_begin,
strip_receipts,
);
let locked_block = enact_result.map_err(|e| {
let mut locked_block = enact_result.map_err(|e| {
warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
})?;
// Strip receipts for blocks before validate_receipts_transition,
// if the expected receipts root header does not match.
// (i.e. allow inconsistency in receipts outcome before the transition block)
if header.number() < engine.params().validate_receipts_transition
&& header.receipts_root() != locked_block.block().header().receipts_root()
{
locked_block.strip_receipts_outcomes();
}
// Final Verification
if let Err(e) = self.verifier.verify_block_final(&header, locked_block.block().header()) {
warn!(target: "client", "Stage 5 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);