Grandpa justifications: Avoid duplicate vote ancestries (#2634) (#2635)

* Grandpa justifications: Avoid duplicate vote ancestries
This commit is contained in:
Serban Iorga
2023-10-19 08:16:40 +03:00
committed by Bastian Köcher
parent 0067c9fa7c
commit dcd2debbb2
7 changed files with 114 additions and 16 deletions
@@ -42,7 +42,7 @@ struct AncestryChain(bp_header_chain::justification::AncestryChain<TestHeader>);
impl AncestryChain {
fn new(justification: &GrandpaJustification<TestHeader>) -> Self {
Self(bp_header_chain::justification::AncestryChain::new(justification))
Self(bp_header_chain::justification::AncestryChain::new(justification).0)
}
}
@@ -58,7 +58,7 @@ impl finality_grandpa::Chain<TestHash, TestNumber> for AncestryChain {
if current_hash == base {
break
}
match self.0.parents.get(&current_hash) {
match self.0.parent_hash_of(&current_hash) {
Some(parent_hash) => {
current_hash = *parent_hash;
route.push(current_hash);