6
6
static void
7
7
fd_runtime_fuzz_block_refresh_vote_accounts ( fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_pool ,
8
8
fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_root ,
9
+ fd_vote_states_t * vote_states ,
9
10
fd_stake_delegations_t * stake_delegations ) {
10
11
fd_stake_delegation_map_t * map = fd_stake_delegations_get_map ( stake_delegations );
11
12
fd_stake_delegation_t * pool = fd_stake_delegations_get_pool ( stake_delegations );
@@ -25,6 +26,10 @@ fd_runtime_fuzz_block_refresh_vote_accounts( fd_vote_accounts_pair_global_t_mapn
25
26
if ( FD_LIKELY ( found_node ) ) {
26
27
found_node -> elem .stake += stake ;
27
28
}
29
+ fd_vote_state_ele_t * vote_state = fd_vote_states_query ( vote_states , voter_pubkey );
30
+ ulong vote_stake = vote_state -> stake ;
31
+ fd_vote_states_update_stake ( vote_states , voter_pubkey , vote_stake + stake );
32
+
28
33
}
29
34
}
30
35
@@ -282,21 +287,20 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
282
287
stake_delegations = fd_stake_delegations_join ( fd_stake_delegations_new ( stake_delegations , FD_RUNTIME_MAX_STAKE_ACCOUNTS ) );
283
288
284
289
/* Load in all accounts with > 0 lamports provided in the context. The input expects unique account pubkeys. */
290
+ vote_states = fd_bank_vote_states_locking_modify ( slot_ctx -> bank );
285
291
for ( ushort i = 0 ; i < test_ctx -> acct_states_count ; i ++ ) {
286
292
FD_TXN_ACCOUNT_DECL (acc );
287
293
fd_runtime_fuzz_load_account ( acc , funk , funk_txn , & test_ctx -> acct_states [i ], 1 );
288
294
289
295
/* Update vote accounts cache for epoch T */
290
296
fd_pubkey_t pubkey ;
291
297
memcpy ( & pubkey , test_ctx -> acct_states [i ].address , sizeof (fd_pubkey_t ) );
292
- vote_states = fd_bank_vote_states_locking_modify ( slot_ctx -> bank );
293
298
fd_runtime_fuzz_block_register_vote_account ( slot_ctx ,
294
299
vote_states ,
295
300
vote_accounts_pool ,
296
301
& vote_accounts_root ,
297
302
& pubkey ,
298
303
runner -> spad );
299
- fd_bank_vote_states_end_locking_modify ( slot_ctx -> bank );
300
304
301
305
/* Update the stake delegations cache for epoch T */
302
306
fd_runtime_fuzz_block_register_stake_delegation ( slot_ctx ,
@@ -307,14 +311,14 @@ fd_runtime_fuzz_block_ctx_create( fd_runtime_fuzz_runner_t * runner,
307
311
/* Refresh vote accounts to calculate stake delegations */
308
312
fd_runtime_fuzz_block_refresh_vote_accounts ( vote_accounts_pool ,
309
313
vote_accounts_root ,
314
+ vote_states ,
310
315
stake_delegations );
316
+ fd_bank_vote_states_end_locking_modify ( slot_ctx -> bank );
317
+
311
318
312
319
fd_vote_accounts_vote_accounts_pool_update ( curr_stakes , vote_accounts_pool );
313
320
fd_vote_accounts_vote_accounts_root_update ( curr_stakes , vote_accounts_root );
314
321
315
- // fd_vote_accounts_stake_delegations_pool_update( curr_stakes, stake_delegations_pool );
316
- // fd_vote_accounts_stake_delegations_root_update( curr_stakes, stake_delegations_root );
317
-
318
322
fd_bank_curr_epoch_stakes_end_locking_modify ( slot_ctx -> bank );
319
323
fd_bank_stake_delegations_end_locking_modify ( slot_ctx -> bank );
320
324
0 commit comments