Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Sep 25, 2023
1 parent 935df43 commit 7c45985
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion program-test/tests/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async fn test_stake_redelegation_pending_activation(merge_flag: PendingStakeActi
// 3. create 2nd vote account
let vote_address2 = setup_vote(&mut context).await;

// 3.1 relegate 1st stake account to 2nd stake account.
// 3.1 relegate stake account to 2nd vote account, which creates 2nd stake account
let stake_keypair2 = Keypair::new();
let stake_address2 = stake_keypair2.pubkey();
let transaction = Transaction::new_signed_with_payer(
Expand Down
5 changes: 2 additions & 3 deletions programs/stake/src/stake_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,18 +639,17 @@ fn deactivate_stake(
stake_flags: &mut StakeFlags,
epoch: Epoch,
) -> Result<(), InstructionError> {
let stake_history = invoke_context.get_sysvar_cache().get_stake_history()?;

if invoke_context
.feature_set
.is_active(&feature_set::stake_redelegate_instruction::id())
{
if stake_flags.contains(StakeFlags::MUST_FULLY_ACTIVATE_BEFORE_DEACTIVATION_IS_PERMITTED) {
let stake_history = invoke_context.get_sysvar_cache().get_stake_history()?;
// when MUST_FULLY_ACTIVATE_BEFORE_DEACTIVATION_IS_PERMITTED flag is set on stake_flags,
// deactivation is only permitted when the stake delegation activating amount is zero.
let status = stake.delegation.stake_activating_and_deactivating(
epoch,
Some(&stake_history),
Some(stake_history.as_ref()),
new_warmup_cooldown_rate_epoch(invoke_context),
);
if status.activating != 0 {
Expand Down

0 comments on commit 7c45985

Please sign in to comment.