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

Commit

Permalink
Fork tree prune assumptions removal v2 (#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
davxy and andresilva authored Feb 15, 2023
1 parent 169c3f0 commit a10ccb5
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 a10ccb5

Please sign in to comment.