4040 solana_vote_program:: {
4141 vote_error:: VoteError ,
4242 vote_instruction:: { self , withdraw, CreateVoteAccountConfig } ,
43- vote_state:: { VoteAuthorize , VoteInit , VoteState , VoteStateVersions } ,
43+ vote_state:: {
44+ VoteAuthorize , VoteInit , VoteState , VoteStateVersions , VOTE_CREDITS_MAXIMUM_PER_SLOT ,
45+ } ,
4446 } ,
4547 std:: rc:: Rc ,
4648} ;
@@ -1293,6 +1295,9 @@ pub fn process_show_vote_account(
12931295 get_vote_account ( rpc_client, vote_account_address, config. commitment ) ?;
12941296
12951297 let epoch_schedule = rpc_client. get_epoch_schedule ( ) ?;
1298+ let tvc_activation_slot =
1299+ rpc_client. get_feature_activation_slot ( & solana_feature_set:: timely_vote_credits:: id ( ) ) ?;
1300+ let tvc_activation_epoch = tvc_activation_slot. map ( |s| epoch_schedule. get_epoch ( s) ) ;
12961301
12971302 let mut votes: Vec < CliLandedVote > = vec ! [ ] ;
12981303 let mut epoch_voting_history: Vec < CliEpochVotingHistory > = vec ! [ ] ;
@@ -1303,12 +1308,19 @@ pub fn process_show_vote_account(
13031308 for ( epoch, credits, prev_credits) in vote_state. epoch_credits ( ) . iter ( ) . copied ( ) {
13041309 let credits_earned = credits. saturating_sub ( prev_credits) ;
13051310 let slots_in_epoch = epoch_schedule. get_slots_in_epoch ( epoch) ;
1311+ let is_tvc_active = tvc_activation_epoch. map ( |e| epoch >= e) . unwrap_or_default ( ) ;
1312+ let max_credits_per_slot = if is_tvc_active {
1313+ VOTE_CREDITS_MAXIMUM_PER_SLOT
1314+ } else {
1315+ 1
1316+ } ;
13061317 epoch_voting_history. push ( CliEpochVotingHistory {
13071318 epoch,
13081319 slots_in_epoch,
13091320 credits_earned,
13101321 credits,
13111322 prev_credits,
1323+ max_credits_per_slot,
13121324 } ) ;
13131325 }
13141326 }
0 commit comments