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::{ 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,18 +107,25 @@ pub fn load(
) )
}; };
to_loadresult( blockstore_processor::process_blockstore_from_root(
blockstore_processor::process_blockstore_from_root( blockstore,
blockstore, bank_forks,
bank_forks, &process_options,
&process_options, transaction_status_sender,
transaction_status_sender, cache_block_meta_sender,
cache_block_meta_sender, snapshot_config,
snapshot_config, accounts_package_sender,
accounts_package_sender, last_full_snapshot_slot,
last_full_snapshot_slot, )
), .map(
starting_snapshot_hashes, |(bank_forks, leader_schedule_cache, last_full_snapshot_slot)| {
(
bank_forks,
leader_schedule_cache,
last_full_snapshot_slot,
starting_snapshot_hashes,
)
},
) )
} }