diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 348911424ae..ff09f7c72a5 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -481,7 +481,7 @@ impl Importer { let mut batch = DBTransaction::new(); - let ancestry_actions = self.engine.ancestry_actions(&block, &mut chain.ancestry_with_metadata_iter(*parent)); + let ancestry_actions = self.engine.ancestry_actions(&header, &mut chain.ancestry_with_metadata_iter(*parent)); let receipts = block.receipts; let traces = block.traces.drain(); diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index c6195d0b24c..1a54ccec1b6 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -798,6 +798,7 @@ impl AuthorityRound { } }; + let epoch_transition_hash = epoch_manager.epoch_transition_hash; let ancestry_iter = ancestry.map(|header| { let mut signers = vec![*header.author()]; signers.extend(parent_empty_steps_signers.drain(..)); @@ -815,10 +816,11 @@ impl AuthorityRound { None } }) - .while_some(); + .while_some() + .take_while(|&(h, _)| h != epoch_transition_hash); - if let Err(_) = epoch_manager.finality_checker.build_ancestry_subchain(ancestry_iter) { - debug!(target: "engine", "inconsistent validator set within epoch"); + if let Err(e) = epoch_manager.finality_checker.build_ancestry_subchain(ancestry_iter) { + debug!(target: "engine", "inconsistent validator set within epoch: {:?}", e); return Vec::new(); } } @@ -1448,9 +1450,9 @@ impl Engine for AuthorityRound { super::total_difficulty_fork_choice(new, current) } - fn ancestry_actions(&self, block: &ExecutedBlock, ancestry: &mut Iterator) -> Vec { + fn ancestry_actions(&self, header: &Header, ancestry: &mut Iterator) -> Vec { let finalized = self.build_finality( - block.header(), + header, &mut ancestry.take_while(|e| !e.is_finalized).map(|e| e.header), ); diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 9bf7fa92b3a..39f3ac20471 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -429,7 +429,7 @@ pub trait Engine: Sync + Send { /// Gather all ancestry actions. Called at the last stage when a block is committed. The Engine must guarantee that /// the ancestry exists. - fn ancestry_actions(&self, _block: &M::LiveBlock, _ancestry: &mut Iterator) -> Vec { + fn ancestry_actions(&self, _header: &M::Header, _ancestry: &mut Iterator) -> Vec { Vec::new() }