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

finality: dont require chain head to be in the chain #10054

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,16 +1421,21 @@ impl Engine<EthereumMachine> for AuthorityRound {
let mut finality_proof: Vec<_> = itertools::repeat_call(move || {
chain(hash).and_then(|header| {
hash = *header.parent_hash();
if header.number() == 0 { return None }
else { return Some(header) }
if header.number() == 0 { None }
else { Some(header) }
})
})
.while_some()
.take_while(|h| h.hash() != *finalized_hash)
.collect();

let finalized_header = chain(*finalized_hash)
.expect("header is finalized; finalized headers must exist in the chain; qed");
let finalized_header = if *finalized_hash == chain_head.hash() {
// chain closure only stores ancestry, but the chain head is also unfinalized.
chain_head.clone()
} else {
chain(*finalized_hash)
.expect("header is finalized; finalized headers must exist in the chain; qed")
};

let signal_number = finalized_header.number();
info!(target: "engine", "Applying validator set change signalled at block {}", signal_number);
Expand Down