Add struct and convenience methods to track stake activation status (#20392)
* Add struct and convenience methods to track stake activation status * fix nits * rename
This commit is contained in:
@@ -39,13 +39,11 @@ use solana_sdk::{
|
||||
stake::{
|
||||
self,
|
||||
instruction::{self as stake_instruction, LockupArgs, StakeError},
|
||||
state::{Authorized, Lockup, Meta, StakeAuthorize, StakeState},
|
||||
state::{Authorized, Lockup, Meta, StakeActivationStatus, StakeAuthorize, StakeState},
|
||||
},
|
||||
stake_history::StakeHistory,
|
||||
system_instruction::SystemError,
|
||||
sysvar::{
|
||||
clock,
|
||||
stake_history::{self, StakeHistory},
|
||||
},
|
||||
sysvar::{clock, stake_history},
|
||||
transaction::Transaction,
|
||||
};
|
||||
use solana_vote_program::vote_state::VoteState;
|
||||
@@ -2013,7 +2011,11 @@ pub fn build_stake_state(
|
||||
stake,
|
||||
) => {
|
||||
let current_epoch = clock.epoch;
|
||||
let (active_stake, activating_stake, deactivating_stake) = stake
|
||||
let StakeActivationStatus {
|
||||
effective,
|
||||
activating,
|
||||
deactivating,
|
||||
} = stake
|
||||
.delegation
|
||||
.stake_activating_and_deactivating(current_epoch, Some(stake_history));
|
||||
let lockup = if lockup.is_in_force(clock, None) {
|
||||
@@ -2048,9 +2050,9 @@ pub fn build_stake_state(
|
||||
use_lamports_unit,
|
||||
current_epoch,
|
||||
rent_exempt_reserve: Some(*rent_exempt_reserve),
|
||||
active_stake: u64_some_if_not_zero(active_stake),
|
||||
activating_stake: u64_some_if_not_zero(activating_stake),
|
||||
deactivating_stake: u64_some_if_not_zero(deactivating_stake),
|
||||
active_stake: u64_some_if_not_zero(effective),
|
||||
activating_stake: u64_some_if_not_zero(activating),
|
||||
deactivating_stake: u64_some_if_not_zero(deactivating),
|
||||
..CliStakeState::default()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user