From b4b9763a005d619fd348905df16df08a6d74b74c Mon Sep 17 00:00:00 2001 From: Jon Cinque Date: Sat, 14 Aug 2021 01:15:50 -0400 Subject: [PATCH] stake-pool: Cleanup comments and rename functions (#2283) --- stake-pool/program/src/processor.rs | 4 ++-- stake-pool/program/src/state.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stake-pool/program/src/processor.rs b/stake-pool/program/src/processor.rs index d511d942..0cb7a475 100644 --- a/stake-pool/program/src/processor.rs +++ b/stake-pool/program/src/processor.rs @@ -2200,7 +2200,7 @@ impl Processor { let has_active_stake = validator_list .find::( &0u64.to_le_bytes(), - ValidatorStakeInfo::memcmp_active_lamports, + ValidatorStakeInfo::active_lamports_not_equal, ) .is_some(); @@ -2209,7 +2209,7 @@ impl Processor { let has_transient_stake = validator_list .find::( &0u64.to_le_bytes(), - ValidatorStakeInfo::memcmp_transient_lamports, + ValidatorStakeInfo::transient_lamports_not_equal, ) .is_some(); if has_transient_stake || has_active_stake { diff --git a/stake-pool/program/src/state.rs b/stake-pool/program/src/state.rs index 6271f2d8..96b5c853 100644 --- a/stake-pool/program/src/state.rs +++ b/stake-pool/program/src/state.rs @@ -310,7 +310,7 @@ impl StakePool { Ok(()) } - /// Check staker validity and signature + /// Check mint is correct #[inline] pub(crate) fn check_mint(&self, mint_info: &AccountInfo) -> Result<(), ProgramError> { if *mint_info.key != self.pool_mint { @@ -371,7 +371,7 @@ impl StakePool { } } - /// Check the validator list is valid + /// Check the reserve stake is valid pub fn check_reserve_stake( &self, reserve_stake_info: &AccountInfo, @@ -528,14 +528,14 @@ impl ValidatorStakeInfo { } /// Performs a very cheap comparison, for checking if this validator stake - /// info has active lamports equal to the given bytes - pub fn memcmp_active_lamports(data: &[u8], lamports_le_bytes: &[u8]) -> bool { + /// info does not have active lamports equal to the given bytes + pub fn active_lamports_not_equal(data: &[u8], lamports_le_bytes: &[u8]) -> bool { sol_memcmp(&data[0..8], lamports_le_bytes, 8) != 0 } /// Performs a very cheap comparison, for checking if this validator stake - /// info has lamports equal to the given bytes - pub fn memcmp_transient_lamports(data: &[u8], lamports_le_bytes: &[u8]) -> bool { + /// info does not have lamports equal to the given bytes + pub fn transient_lamports_not_equal(data: &[u8], lamports_le_bytes: &[u8]) -> bool { sol_memcmp(&data[8..16], lamports_le_bytes, 8) != 0 }