@@ -859,6 +859,9 @@ pub enum BlockstoreProcessorError {
859
859
#[ error( "failed to load meta" ) ]
860
860
FailedToLoadMeta ,
861
861
862
+ #[ error( "failed to replay bank 0, did you forget to provide a snapshot" ) ]
863
+ FailedToReplayBank0 ,
864
+
862
865
#[ error( "invalid block error: {0}" ) ]
863
866
InvalidBlock ( #[ from] BlockError ) ,
864
867
@@ -994,7 +997,7 @@ pub(crate) fn process_blockstore_for_bank_0(
994
997
entry_notification_sender : Option < & EntryNotifierSender > ,
995
998
accounts_update_notifier : Option < AccountsUpdateNotifier > ,
996
999
exit : Arc < AtomicBool > ,
997
- ) -> Arc < RwLock < BankForks > > {
1000
+ ) -> result :: Result < Arc < RwLock < BankForks > > , BlockstoreProcessorError > {
998
1001
// Setup bank for slot 0
999
1002
let bank0 = Bank :: new_with_paths (
1000
1003
genesis_config,
@@ -1027,8 +1030,9 @@ pub(crate) fn process_blockstore_for_bank_0(
1027
1030
& VerifyRecyclers :: default ( ) ,
1028
1031
block_meta_sender,
1029
1032
entry_notification_sender,
1030
- ) ;
1031
- bank_forks
1033
+ ) ?;
1034
+
1035
+ Ok ( bank_forks)
1032
1036
}
1033
1037
1034
1038
/// Process blockstore from a known root bank
@@ -1818,7 +1822,7 @@ fn process_bank_0(
1818
1822
recyclers : & VerifyRecyclers ,
1819
1823
block_meta_sender : Option < & BlockMetaSender > ,
1820
1824
entry_notification_sender : Option < & EntryNotifierSender > ,
1821
- ) {
1825
+ ) -> result :: Result < ( ) , BlockstoreProcessorError > {
1822
1826
assert_eq ! ( bank0. slot( ) , 0 ) ;
1823
1827
let mut progress = ConfirmationProgress :: new ( bank0. last_blockhash ( ) ) ;
1824
1828
confirm_full_slot (
@@ -1833,7 +1837,7 @@ fn process_bank_0(
1833
1837
None ,
1834
1838
& mut ExecuteTimings :: default ( ) ,
1835
1839
)
1836
- . expect ( "Failed to process bank 0 from ledger. Did you forget to provide a snapshot?" ) ;
1840
+ . map_err ( |_| BlockstoreProcessorError :: FailedToReplayBank0 ) ? ;
1837
1841
if let Some ( ( result, _timings) ) = bank0. wait_for_completed_scheduler ( ) {
1838
1842
result. unwrap ( ) ;
1839
1843
}
@@ -1842,6 +1846,8 @@ fn process_bank_0(
1842
1846
blockstore. insert_bank_hash ( bank0. slot ( ) , bank0. hash ( ) , false ) ;
1843
1847
}
1844
1848
send_block_meta ( bank0, block_meta_sender) ;
1849
+
1850
+ Ok ( ( ) )
1845
1851
}
1846
1852
1847
1853
// Given a bank, add its children to the pending slots queue if those children slots are
@@ -4201,7 +4207,8 @@ pub mod tests {
4201
4207
& recyclers,
4202
4208
None ,
4203
4209
None ,
4204
- ) ;
4210
+ )
4211
+ . unwrap ( ) ;
4205
4212
let bank0_last_blockhash = bank0. last_blockhash ( ) ;
4206
4213
let bank1 = bank_forks. write ( ) . unwrap ( ) . insert ( Bank :: new_from_parent (
4207
4214
bank0. clone_without_scheduler ( ) ,
0 commit comments