mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-04 08:07:24 +00:00
fork tree: rebalance fork tree by max fork depth (#4605)
* fork-tree: rebalance fork tree by maximum branch height * fork-tree: add docs for tree rebalancing * fork-tree: add test * babe: rebalance epoch changes tree on deserialization * fork-tree: fix doc * fork-tree: fix test
This commit is contained in:
@@ -185,6 +185,12 @@ impl<Hash, Number> EpochChanges<Hash, Number> where
|
||||
EpochChanges { inner: ForkTree::new() }
|
||||
}
|
||||
|
||||
/// Rebalances the tree of epoch changes so that it is sorted by length of
|
||||
/// fork (longest fork first).
|
||||
pub fn rebalance(&mut self) {
|
||||
self.inner.rebalance()
|
||||
}
|
||||
|
||||
/// Prune out finalized epochs, except for the ancestor of the finalized
|
||||
/// block. The given slot should be the slot number at which the finalized
|
||||
/// block was authored.
|
||||
|
||||
Reference in New Issue
Block a user