Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed May 30, 2023
1 parent 6c52039 commit 9afe8eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/program/src/stake/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,13 @@ impl Stake {
Ok(new)
}

pub fn deactivate(&mut self, epoch: Epoch) -> Result<(), StakeError> {
pub fn deactivate(&mut self, epoch: Epoch, flag: MustFullyActivateBeforeDeactivationIsPermittedFlag) -> Result<(), StakeError> {
if self.delegation.deactivation_epoch != std::u64::MAX {
Err(StakeError::AlreadyDeactivated)

else if flag == 1 && epoch < self.delegation.activation_epoch {
Err(StakeError::MustFullyActivateBeforeDeactivationIsPermitted)
}
} else {
self.delegation.deactivation_epoch = epoch;
Ok(())
Expand Down

0 comments on commit 9afe8eb

Please sign in to comment.