@@ -2089,8 +2089,7 @@ read_snapshot( void * _ctx,
2089
2089
/* Funk already has a snapshot loaded */
2090
2090
fd_runtime_recover_banks ( ctx -> slot_ctx , 1 , 1 , ctx -> runtime_spad );
2091
2091
base_slot = ctx -> slot_ctx -> slot_bank .slot ;
2092
- publish_stake_weights ( ctx , stem , ctx -> slot_ctx );
2093
- fd_fseq_update ( ctx -> published_wmark , ctx -> slot_ctx -> slot_bank .slot );
2092
+ kickoff_repair_orphans ( ctx , stem );
2094
2093
} else {
2095
2094
2096
2095
/* If we have an incremental snapshot try to prefetch the snapshot slot
@@ -2342,13 +2341,17 @@ init_snapshot( fd_replay_tile_ctx_t * ctx,
2342
2341
ctx -> genesis ,
2343
2342
is_snapshot ,
2344
2343
ctx -> capture_ctx ,
2345
- NULL ,
2346
2344
ctx -> runtime_spad );
2347
- fd_blockstore_init ( ctx -> slot_ctx -> blockstore ,
2348
- ctx -> blockstore_fd ,
2349
- FD_BLOCKSTORE_ARCHIVE_MIN_SIZE ,
2350
- & ctx -> slot_ctx -> slot_bank );
2351
-
2345
+ if ( !is_snapshot ) {
2346
+ /* read_snapshot calls kickoff_repair_orphans which calls init_blockstore.
2347
+ Thus we need to call init_blockstore here if snapshot isn't read.
2348
+ We call this after fd_runtime_read_genesis, which sets up the
2349
+ slot_bank needed in blockstore_init */
2350
+ fd_blockstore_init ( ctx -> slot_ctx -> blockstore ,
2351
+ ctx -> blockstore_fd ,
2352
+ FD_BLOCKSTORE_ARCHIVE_MIN_SIZE ,
2353
+ & ctx -> slot_ctx -> slot_bank );
2354
+ }
2352
2355
ctx -> epoch_ctx -> bank_hash_cmp = ctx -> bank_hash_cmp ;
2353
2356
ctx -> epoch_ctx -> runtime_public = ctx -> runtime_public ;
2354
2357
init_after_snapshot ( ctx , stem );
@@ -2367,6 +2370,33 @@ init_snapshot( fd_replay_tile_ctx_t * ctx,
2367
2370
2368
2371
send_exec_epoch_msg ( ctx , stem , ctx -> slot_ctx );
2369
2372
2373
+ /* Publish slot notifs */
2374
+ ulong curr_slot = ctx -> curr_slot ;
2375
+ ulong block_entry_height = 0 ;
2376
+
2377
+ if ( is_snapshot ){
2378
+ for (;;){
2379
+ fd_block_map_query_t query [1 ] = { 0 };
2380
+ int err = fd_block_map_query_try ( ctx -> blockstore -> block_map , & curr_slot , NULL , query , 0 );
2381
+ fd_block_info_t * block_info = fd_block_map_query_ele ( query );
2382
+ if ( FD_UNLIKELY ( err == FD_MAP_ERR_KEY ) ) FD_LOG_ERR (( "Failed to query blockstore for slot %lu" , curr_slot ));
2383
+ if ( FD_UNLIKELY ( err == FD_MAP_ERR_AGAIN ) ) {
2384
+ FD_LOG_WARNING (( "Waiting for block map query for slot %lu" , curr_slot ));
2385
+ continue ;
2386
+ };
2387
+ block_entry_height = block_info -> block_height ;
2388
+ if ( FD_UNLIKELY ( fd_block_map_query_test ( query ) == FD_MAP_SUCCESS ) ) break ;
2389
+ }
2390
+ } else {
2391
+ /* Block after genesis has a height of 1.
2392
+ TODO: We should be able to query slot 1 block_map entry to get this
2393
+ (using the above for loop), but blockstore/fork setup on genesis is
2394
+ broken for now. */
2395
+ block_entry_height = 1UL ;
2396
+ }
2397
+
2398
+ publish_slot_notifications ( ctx , stem , fork , block_entry_height , curr_slot );
2399
+
2370
2400
2371
2401
FD_TEST ( ctx -> slot_ctx );
2372
2402
}
0 commit comments