40
40
solana_vote_program:: {
41
41
vote_error:: VoteError ,
42
42
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
+ } ,
44
46
} ,
45
47
std:: rc:: Rc ,
46
48
} ;
@@ -1293,6 +1295,9 @@ pub fn process_show_vote_account(
1293
1295
get_vote_account ( rpc_client, vote_account_address, config. commitment ) ?;
1294
1296
1295
1297
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) ) ;
1296
1301
1297
1302
let mut votes: Vec < CliLandedVote > = vec ! [ ] ;
1298
1303
let mut epoch_voting_history: Vec < CliEpochVotingHistory > = vec ! [ ] ;
@@ -1303,12 +1308,19 @@ pub fn process_show_vote_account(
1303
1308
for ( epoch, credits, prev_credits) in vote_state. epoch_credits ( ) . iter ( ) . copied ( ) {
1304
1309
let credits_earned = credits. saturating_sub ( prev_credits) ;
1305
1310
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
+ } ;
1306
1317
epoch_voting_history. push ( CliEpochVotingHistory {
1307
1318
epoch,
1308
1319
slots_in_epoch,
1309
1320
credits_earned,
1310
1321
credits,
1311
1322
prev_credits,
1323
+ max_credits_per_slot,
1312
1324
} ) ;
1313
1325
}
1314
1326
}
0 commit comments