From df3e81a1e9e85c12a5e0b9bebeabb13a43cf5023 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Sun, 7 Apr 2024 22:52:55 -0400 Subject: [PATCH] Remove single-use fn --- programs/stake/src/stake_instruction.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/programs/stake/src/stake_instruction.rs b/programs/stake/src/stake_instruction.rs index 630e5d967eab8a..1ffe4bb20478c4 100644 --- a/programs/stake/src/stake_instruction.rs +++ b/programs/stake/src/stake_instruction.rs @@ -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) => {