From 950fe38aaf4a3e63df752c3b5022d939462eddb9 Mon Sep 17 00:00:00 2001 From: Charles Li Date: Tue, 10 Dec 2024 20:32:26 +0000 Subject: [PATCH] fix(bank_hash_cmp): add to tower sync --- .../runtime/program/fd_vote_program.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/flamenco/runtime/program/fd_vote_program.c b/src/flamenco/runtime/program/fd_vote_program.c index f0611f54f7..a7110164fb 100644 --- a/src/flamenco/runtime/program/fd_vote_program.c +++ b/src/flamenco/runtime/program/fd_vote_program.c @@ -2042,6 +2042,29 @@ process_tower_sync( ulong vote_acct_idx, fd_pubkey_t const * signers[static FD_TXN_SIG_MAX], fd_exec_instr_ctx_t const * ctx /* feature_set */ ) { + if( !deq_fd_vote_lockout_t_empty( tower_sync->lockouts ) ) { + fd_vote_lockout_t * lockout = deq_fd_vote_lockout_t_peek_tail( tower_sync->lockouts ); + fd_bank_hash_cmp_t * bank_hash_cmp = ctx->slot_ctx->epoch_ctx->bank_hash_cmp; + if( FD_LIKELY( lockout && bank_hash_cmp ) ) { + fd_bank_hash_cmp_lock( bank_hash_cmp ); + fd_bank_hash_cmp_insert( + bank_hash_cmp, + lockout->slot, + &tower_sync->hash, + 0, + fd_query_pubkey_stake( vote_account->pubkey, + &ctx->epoch_ctx->epoch_bank.stakes.vote_accounts ) ); + + if( FD_LIKELY( tower_sync->has_root ) ) { + fd_bank_hash_cmp_entry_t * cmp = + fd_bank_hash_cmp_map_query( bank_hash_cmp->map, tower_sync->root, NULL ); + if( FD_LIKELY( cmp ) ) cmp->rooted = 1; + } + + fd_bank_hash_cmp_unlock( bank_hash_cmp ); + } + } + // https://github.com/anza-xyz/agave/blob/v2.0.1/programs/vote/src/vote_state/mod.rs#L1194 fd_vote_state_t vote_state; do {