Skip to content

Commit

Permalink
Remove single-use fn
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Apr 8, 2024
1 parent 2e21beb commit df3e81a
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions programs/stake/src/stake_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,12 @@ declare_process_instruction!(Entrypoint, DEFAULT_COMPUTE_UNITS, |invoke_context|
.map(|epoch_rewards| epoch_rewards.active)
.unwrap_or(false);

let error_during_epoch_rewards = || {
if epoch_rewards_active {
Err::<(), InstructionError>(StakeError::EpochRewardsActive.into())
} else {
Ok(())
}
};

let signers = instruction_context.get_signers(transaction_context)?;

let stake_instruction: StakeInstruction = limited_deserialize(data)?;
if !matches!(stake_instruction, StakeInstruction::GetMinimumDelegation) {
error_during_epoch_rewards()?;
if epoch_rewards_active && !matches!(stake_instruction, StakeInstruction::GetMinimumDelegation)
{
return Err(StakeError::EpochRewardsActive.into());
}
match stake_instruction {
StakeInstruction::Initialize(authorized, lockup) => {
Expand Down

0 comments on commit df3e81a

Please sign in to comment.