Add snapshot_utils::bank_from_latest_snapshot_archives() (#18983)
While reviewing PR #18565, as issue was brought up to refactor some code around verifying the bank after rebuilding from snapshots. A new top-level function has been added to get the latest snapshot archives and load the bank then verify. Additionally, new tests have been written and existing tests have been updated to use this new function. Fixes #18973 While resolving the issue, it became clear there was some additional low-hanging fruit this change enabled. Specifically, the functions `bank_to_xxx_snapshot_archive()` now return their respective `SnapshotArchiveInfo`. And on the flip side, `bank_from_snapshot_archives()` now takes `SnapshotArchiveInfo`s instead of separate paths and archive formats. This bundling simplifies bank rebuilding.
This commit is contained in:
@ -49,7 +49,8 @@ use {
|
||||
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_utils::{
|
||||
self, ArchiveFormat, SnapshotVersion, DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||
self, ArchiveFormat, SnapshotArchiveInfoGetter, SnapshotVersion,
|
||||
DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN,
|
||||
},
|
||||
},
|
||||
solana_sdk::{
|
||||
@ -482,7 +483,7 @@ fn get_rpc_node(
|
||||
let mut highest_snapshot_hash: Option<(Slot, Hash)> =
|
||||
snapshot_utils::get_highest_full_snapshot_archive_info(snapshot_output_dir).map(
|
||||
|snapshot_archive_info| {
|
||||
(*snapshot_archive_info.slot(), *snapshot_archive_info.hash())
|
||||
(snapshot_archive_info.slot(), *snapshot_archive_info.hash())
|
||||
},
|
||||
);
|
||||
let eligible_rpc_peers = if snapshot_not_required {
|
||||
|
Reference in New Issue
Block a user