Skip to content

Commit

Permalink
Fork tree prune assumptions removal v2 (paritytech#13327)
Browse files Browse the repository at this point in the history
* Removed assumptions about ancestry from fork tree prune method

* Tests improvement

* Fork tree prune refactory

* Code refactory

* Correctly handle borderline, but legit, case

* Apply suggestions from code review

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Removed duplicated test

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
  • Loading branch information
2 people authored and ltfschoen committed Feb 22, 2023
1 parent ca561a4 commit b4a7ba3
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 148 deletions.
4 changes: 2 additions & 2 deletions client/consensus/epochs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ mod tests {

let mut nodes: Vec<_> = epoch_changes.tree().iter().map(|(h, _, _)| h).collect();
nodes.sort();
assert_eq!(nodes, vec![b"A", b"B", b"C", b"E", b"F", b"G"]);
assert_eq!(nodes, vec![b"A", b"B", b"C", b"F", b"G"]);

// Finalize block y @ number 35, slot 330
// This should prune all nodes imported by blocks with a number < 35 that are not
Expand All @@ -1050,7 +1050,7 @@ mod tests {

let mut nodes: Vec<_> = epoch_changes.tree().iter().map(|(h, _, _)| h).collect();
nodes.sort();
assert_eq!(nodes, vec![b"B", b"C", b"F", b"G"]);
assert_eq!(nodes, vec![b"B", b"C", b"G"]);
}

#[test]
Expand Down
Loading

0 comments on commit b4a7ba3

Please sign in to comment.