Skip to content

Commit 7be9a2d

Browse files
more
1 parent 39375b6 commit 7be9a2d

File tree

9 files changed

+269
-419
lines changed

9 files changed

+269
-419
lines changed

src/discof/replay/fd_replay_tile.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,9 @@ restore_slot_ctx( fd_replay_tile_ctx_t * ctx,
530530

531531
fd_exec_slot_ctx_t * recovered_slot_ctx = fd_exec_slot_ctx_recover( ctx->slot_ctx,
532532
manifest_global );
533-
FD_LOG_WARNING(("ASDF"));
534533
if( !recovered_slot_ctx ) {
535534
FD_LOG_ERR(( "Failed to restore slot context from snapshot manifest!" ));
536535
}
537-
FD_LOG_WARNING(("ASDF"));
538536
}
539537

540538
static void
@@ -697,10 +695,9 @@ init_after_snapshot( fd_replay_tile_ctx_t * ctx,
697695
memset( block_id, 0, sizeof(fd_hash_t) );
698696
block_id->key[0] = UCHAR_MAX; /* TODO: would be good to have the actual block id of the snapshot slot */
699697

700-
fd_vote_accounts_global_t const * vote_accounts = fd_bank_curr_epoch_stakes_locking_query( ctx->slot_ctx->bank );
701-
702-
fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_pool = fd_vote_accounts_vote_accounts_pool_join( vote_accounts );
703-
fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_root = fd_vote_accounts_vote_accounts_root_join( vote_accounts );
698+
fd_vote_states_t const * vote_states = fd_bank_vote_states_locking_query( ctx->slot_ctx->bank );
699+
fd_vote_state_map_t * vote_state_map = fd_vote_states_get_map( vote_states );
700+
fd_vote_state_ele_t * vote_state_pool = fd_vote_states_get_pool( vote_states );
704701

705702
/* Send to tower tile */
706703

@@ -709,15 +706,16 @@ init_after_snapshot( fd_replay_tile_ctx_t * ctx,
709706
memcpy( chunk_laddr, block_id, sizeof(fd_hash_t) );
710707

711708
ulong off = sizeof(fd_hash_t);
712-
for( fd_vote_accounts_pair_global_t_mapnode_t * curr = fd_vote_accounts_pair_global_t_map_minimum( vote_accounts_pool, vote_accounts_root );
713-
curr;
714-
curr = fd_vote_accounts_pair_global_t_map_successor( vote_accounts_pool, curr ) ) {
709+
for( fd_vote_state_map_iter_t iter = fd_vote_state_map_iter_init( vote_state_map, vote_state_pool );
710+
!fd_vote_state_map_iter_done( iter, vote_state_map, vote_state_pool );
711+
iter = fd_vote_state_map_iter_next( iter, vote_state_map, vote_state_pool ) ) {
712+
fd_vote_state_ele_t const * vote_state = fd_vote_state_map_iter_ele_const( iter, vote_state_map, vote_state_pool );
715713

716-
if( FD_UNLIKELY( curr->elem.stake > 0UL ) ) {
717-
memcpy( chunk_laddr + off, &curr->elem.key, sizeof(fd_pubkey_t) );
714+
if( FD_UNLIKELY( vote_state->stake > 0UL ) ) {
715+
memcpy( chunk_laddr + off, &vote_state->vote_account, sizeof(fd_pubkey_t) );
718716
off += sizeof(fd_pubkey_t);
719717

720-
memcpy( chunk_laddr + off, &curr->elem.stake, sizeof(ulong) );
718+
memcpy( chunk_laddr + off, &vote_state->stake, sizeof(ulong) );
721719
off += sizeof(ulong);
722720
}
723721
}
@@ -726,14 +724,15 @@ init_after_snapshot( fd_replay_tile_ctx_t * ctx,
726724
}
727725

728726
fd_bank_hash_cmp_t * bank_hash_cmp = ctx->bank_hash_cmp;
729-
for( fd_vote_accounts_pair_global_t_mapnode_t * curr = fd_vote_accounts_pair_global_t_map_minimum( vote_accounts_pool, vote_accounts_root );
730-
curr;
731-
curr = fd_vote_accounts_pair_global_t_map_successor( vote_accounts_pool, curr ) ) {
732-
bank_hash_cmp->total_stake += curr->elem.stake;
727+
for( fd_vote_state_map_iter_t iter = fd_vote_state_map_iter_init( vote_state_map, vote_state_pool );
728+
!fd_vote_state_map_iter_done( iter, vote_state_map, vote_state_pool );
729+
iter = fd_vote_state_map_iter_next( iter, vote_state_map, vote_state_pool ) ) {
730+
fd_vote_state_ele_t const * vote_state = fd_vote_state_map_iter_ele_const( iter, vote_state_map, vote_state_pool );
731+
bank_hash_cmp->total_stake += vote_state->stake;
733732
}
734733
bank_hash_cmp->watermark = snapshot_slot;
735734

736-
fd_bank_curr_epoch_stakes_end_locking_query( ctx->slot_ctx->bank );
735+
fd_bank_vote_states_end_locking_query( ctx->slot_ctx->bank );
737736

738737
ulong root = snapshot_slot;
739738
if( FD_LIKELY( root > fd_fseq_query( ctx->published_wmark ) ) ) {

src/flamenco/rewards/fd_rewards.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,6 @@ calculate_points_all( fd_exec_slot_ctx_t const * slot_ctx,
330330
fd_stake_delegation_map_t * stake_delegation_map = fd_stake_delegations_get_map( stake_delegations );
331331
fd_stake_delegation_t * stake_delegation_pool = fd_stake_delegations_get_pool( stake_delegations );
332332

333-
334-
ulong curr_epoch = fd_bank_epoch_get( bank );
335333
for( fd_stake_delegation_map_iter_t iter = fd_stake_delegation_map_iter_init( stake_delegation_map, stake_delegation_pool );
336334
!fd_stake_delegation_map_iter_done( iter, stake_delegation_map, stake_delegation_pool );
337335
iter = fd_stake_delegation_map_iter_next( iter, stake_delegation_map, stake_delegation_pool ) ) {
@@ -343,11 +341,9 @@ calculate_points_all( fd_exec_slot_ctx_t const * slot_ctx,
343341

344342
fd_vote_states_t const * vote_states = fd_bank_vote_states_locking_query( slot_ctx->bank );
345343
fd_vote_state_ele_t * vote_state_ele = fd_vote_states_query( vote_states, &stake_delegation->vote_account );
344+
346345
if( FD_UNLIKELY( !vote_state_ele ) ) {
347-
FD_LOG_WARNING(( "failed to query vote state %lu %lu %lu %lu", stake_delegation->stake, stake_delegation->activation_epoch, stake_delegation->deactivation_epoch, curr_epoch ));
348346
continue;
349-
} else {
350-
FD_LOG_WARNING(( "queried vote state %lu %lu %lu %lu", stake_delegation->stake, stake_delegation->activation_epoch, stake_delegation->deactivation_epoch, curr_epoch ));
351347
}
352348

353349
uint128 account_points;

0 commit comments

Comments
 (0)