@@ -153,7 +153,6 @@ scratch_align( void ) {
153153FD_FN_PURE static inline ulong
154154scratch_footprint ( FD_PARAM_UNUSED fd_topo_tile_t const * tile ) {
155155 ulong slot_max = tile -> tower .max_live_slots ;
156- int lg_slot_max = fd_ulong_find_msb ( fd_ulong_pow2_up ( slot_max ) ) + 1 ;
157156 FD_LOG_DEBUG (( "hfork footprint %lu" , fd_hfork_footprint ( slot_max , FD_VOTER_MAX ) ));
158157 ulong l = FD_LAYOUT_INIT ;
159158 l = FD_LAYOUT_APPEND ( l , alignof(ctx_t ), sizeof (ctx_t ) );
@@ -163,10 +162,8 @@ scratch_footprint( FD_PARAM_UNUSED fd_topo_tile_t const * tile ) {
163162 l = FD_LAYOUT_APPEND ( l , fd_tower_align (), fd_tower_footprint () );
164163 l = FD_LAYOUT_APPEND ( l , fd_tower_accts_align (), fd_tower_accts_footprint ( FD_VOTER_MAX ) );
165164 l = FD_LAYOUT_APPEND ( l , fd_forks_align (), fd_forks_footprint ( slot_max , FD_VOTER_MAX ) );
166- l = FD_LAYOUT_APPEND ( l , fd_tower_align (), fd_tower_footprint () );
167- l = FD_LAYOUT_APPEND ( l , fd_epoch_stakes_align (), fd_epoch_stakes_footprint ( slot_max ) );
168- l = FD_LAYOUT_APPEND ( l , fd_tower_forks_align (), fd_tower_forks_footprint ( lg_slot_max ) );
169165 l = FD_LAYOUT_APPEND ( l , fd_tower_align (), fd_tower_footprint () ); /* ctx->tower_spare */
166+ l = FD_LAYOUT_APPEND ( l , fd_epoch_stakes_align (), fd_epoch_stakes_footprint ( slot_max ) );
170167 l = FD_LAYOUT_APPEND ( l , notif_align (), notif_footprint ( slot_max ) );
171168 return FD_LAYOUT_FINI ( l , scratch_align () );
172169}
@@ -474,7 +471,12 @@ replay_slot_completed( ctx_t * ctx,
474471 /* Query our on-chain vote acct and reconcile with our local tower. */
475472
476473 int found = query_vote_state_from_accdb ( ctx -> accdb , & xid , ctx -> vote_account , ctx -> our_vote_acct );
477- if ( FD_LIKELY ( found ) ) fd_tower_reconcile ( ctx -> tower , ctx -> root_slot , ctx -> our_vote_acct );
474+ if ( FD_LIKELY ( found ) ) {
475+ fd_tower_reconcile ( ctx -> tower , ctx -> root_slot , ctx -> our_vote_acct );
476+ /* Sanity check that most recent vote in tower exists in tower forks */
477+ fd_tower_vote_t const * last_vote = fd_tower_peek_tail_const ( ctx -> tower );
478+ FD_TEST ( !last_vote || fd_forks_query ( ctx -> forks , last_vote -> slot ) );
479+ }
478480
479481 /* Insert the vote acct addrs and stakes from the bank into accts. */
480482
0 commit comments