Eliminate to_loadresult()

This commit is contained in:
Michael Vines 2022-03-05 15:48:06 +01:00
parent 3d4bf1d00a
commit cf5048faaa
1 changed files with 20 additions and 29 deletions

View File

@ -2,7 +2,7 @@ use {
crate::{
blockstore::Blockstore,
blockstore_processor::{
self, BlockstoreProcessorError, BlockstoreProcessorResult, CacheBlockMetaSender,
self, BlockstoreProcessorError, CacheBlockMetaSender,
ProcessOptions, TransactionStatusSender,
},
leader_schedule_cache::LeaderScheduleCache,
@ -31,22 +31,6 @@ pub type LoadResult = result::Result<
BlockstoreProcessorError,
>;
fn to_loadresult(
bpr: BlockstoreProcessorResult,
starting_snapshot_hashes: Option<StartingSnapshotHashes>,
) -> LoadResult {
bpr.map(
|(bank_forks, leader_schedule_cache, last_full_snapshot_slot)| {
(
bank_forks,
leader_schedule_cache,
last_full_snapshot_slot,
starting_snapshot_hashes,
)
},
)
}
/// Load the banks and accounts
///
/// If a snapshot config is given, and a snapshot is found, it will be loaded. Otherwise, load
@ -123,18 +107,25 @@ pub fn load(
)
};
to_loadresult(
blockstore_processor::process_blockstore_from_root(
blockstore,
bank_forks,
&process_options,
transaction_status_sender,
cache_block_meta_sender,
snapshot_config,
accounts_package_sender,
last_full_snapshot_slot,
),
starting_snapshot_hashes,
blockstore_processor::process_blockstore_from_root(
blockstore,
bank_forks,
&process_options,
transaction_status_sender,
cache_block_meta_sender,
snapshot_config,
accounts_package_sender,
last_full_snapshot_slot,
)
.map(
|(bank_forks, leader_schedule_cache, last_full_snapshot_slot)| {
(
bank_forks,
leader_schedule_cache,
last_full_snapshot_slot,
starting_snapshot_hashes,
)
},
)
}