Make set roots an iterator (#18357)

This commit is contained in:
carllin
2021-07-01 20:02:40 -07:00
committed by GitHub
parent d951916d40
commit 0eca92de18
11 changed files with 58 additions and 46 deletions

View File

@@ -1336,7 +1336,7 @@ pub fn reconcile_blockstore_roots_with_tower(
"Reconciling slots as root based on tower root: {:?} ({}..{}) ",
new_roots, tower_root, last_blockstore_root
);
blockstore.set_roots(&new_roots)?;
blockstore.set_roots(new_roots.iter())?;
} else {
// This indicates we're in bad state; but still don't panic here.
// That's because we might have a chance of recovering properly with
@@ -3176,7 +3176,7 @@ pub mod test {
blockstore.insert_shreds(shreds, None, false).unwrap();
let (shreds, _) = make_slot_entries(4, 1, 42);
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.set_roots(&[3]).unwrap();
blockstore.set_roots(std::iter::once(&3)).unwrap();
assert!(!blockstore.is_root(0));
assert!(!blockstore.is_root(1));
assert!(blockstore.is_root(3));