babe: small compilation fix (#3764)

* babe: fix type on find_pre_digest call

* fork-tree: optimize prune

* babe: fix test compilation
This commit is contained in:
André Silva
2019-10-04 19:55:03 +01:00
committed by GitHub
parent 49fb11a1ea
commit f1cdaae6de
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -115,10 +115,11 @@ impl<H, N, V> ForkTree<H, N, V> where
// we found the deepest ancestor of the finalized block, so we prune
// out any children that don't include the finalized block.
root.children.retain(|node| {
let children = std::mem::replace(&mut root.children, Vec::new());
root.children = children.into_iter().filter(|node| {
node.number == *number && node.hash == *hash ||
node.number < *number && is_descendent_of(&node.hash, hash).unwrap_or(false)
});
}).take(1).collect();
self.roots = vec![root];
}