Eliminate to_loadresult()

This commit is contained in:
Michael Vines
2022-03-05 15:48:06 +01:00
parent 3d4bf1d00a
commit cf5048faaa

View File

@ -2,7 +2,7 @@ use {
crate::{ crate::{
blockstore::Blockstore, blockstore::Blockstore,
blockstore_processor::{ blockstore_processor::{
self, BlockstoreProcessorError, BlockstoreProcessorResult, CacheBlockMetaSender, self, BlockstoreProcessorError, CacheBlockMetaSender,
ProcessOptions, TransactionStatusSender, ProcessOptions, TransactionStatusSender,
}, },
leader_schedule_cache::LeaderScheduleCache, leader_schedule_cache::LeaderScheduleCache,
@ -31,22 +31,6 @@ pub type LoadResult = result::Result<
BlockstoreProcessorError, 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 /// Load the banks and accounts
/// ///
/// If a snapshot config is given, and a snapshot is found, it will be loaded. Otherwise, load /// If a snapshot config is given, and a snapshot is found, it will be loaded. Otherwise, load
@ -123,7 +107,6 @@ pub fn load(
) )
}; };
to_loadresult(
blockstore_processor::process_blockstore_from_root( blockstore_processor::process_blockstore_from_root(
blockstore, blockstore,
bank_forks, bank_forks,
@ -133,9 +116,17 @@ pub fn load(
snapshot_config, snapshot_config,
accounts_package_sender, accounts_package_sender,
last_full_snapshot_slot, 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, starting_snapshot_hashes,
) )
},
)
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]