Use block header for building finality (#9914)
This commit is contained in:
parent
052380b8de
commit
ac974a180d
@ -481,7 +481,7 @@ impl Importer {
|
|||||||
|
|
||||||
let mut batch = DBTransaction::new();
|
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 receipts = block.receipts;
|
||||||
let traces = block.traces.drain();
|
let traces = block.traces.drain();
|
||||||
|
@ -798,6 +798,7 @@ impl AuthorityRound {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let epoch_transition_hash = epoch_manager.epoch_transition_hash;
|
||||||
let ancestry_iter = ancestry.map(|header| {
|
let ancestry_iter = ancestry.map(|header| {
|
||||||
let mut signers = vec![*header.author()];
|
let mut signers = vec![*header.author()];
|
||||||
signers.extend(parent_empty_steps_signers.drain(..));
|
signers.extend(parent_empty_steps_signers.drain(..));
|
||||||
@ -815,10 +816,11 @@ impl AuthorityRound {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.while_some();
|
.while_some()
|
||||||
|
.take_while(|&(h, _)| h != epoch_transition_hash);
|
||||||
|
|
||||||
if let Err(_) = epoch_manager.finality_checker.build_ancestry_subchain(ancestry_iter) {
|
if let Err(e) = epoch_manager.finality_checker.build_ancestry_subchain(ancestry_iter) {
|
||||||
debug!(target: "engine", "inconsistent validator set within epoch");
|
debug!(target: "engine", "inconsistent validator set within epoch: {:?}", e);
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1448,9 +1450,9 @@ impl Engine<EthereumMachine> for AuthorityRound {
|
|||||||
super::total_difficulty_fork_choice(new, current)
|
super::total_difficulty_fork_choice(new, current)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ancestry_actions(&self, block: &ExecutedBlock, ancestry: &mut Iterator<Item=ExtendedHeader>) -> Vec<AncestryAction> {
|
fn ancestry_actions(&self, header: &Header, ancestry: &mut Iterator<Item=ExtendedHeader>) -> Vec<AncestryAction> {
|
||||||
let finalized = self.build_finality(
|
let finalized = self.build_finality(
|
||||||
block.header(),
|
header,
|
||||||
&mut ancestry.take_while(|e| !e.is_finalized).map(|e| e.header),
|
&mut ancestry.take_while(|e| !e.is_finalized).map(|e| e.header),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ pub trait Engine<M: Machine>: Sync + Send {
|
|||||||
|
|
||||||
/// Gather all ancestry actions. Called at the last stage when a block is committed. The Engine must guarantee that
|
/// Gather all ancestry actions. Called at the last stage when a block is committed. The Engine must guarantee that
|
||||||
/// the ancestry exists.
|
/// the ancestry exists.
|
||||||
fn ancestry_actions(&self, _block: &M::LiveBlock, _ancestry: &mut Iterator<Item=M::ExtendedHeader>) -> Vec<AncestryAction> {
|
fn ancestry_actions(&self, _header: &M::Header, _ancestry: &mut Iterator<Item=M::ExtendedHeader>) -> Vec<AncestryAction> {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user