stake-pool: Cleanup comments and rename functions (#2283)
This commit is contained in:
parent
05325a511d
commit
b4b9763a00
|
@ -2200,7 +2200,7 @@ impl Processor {
|
||||||
let has_active_stake = validator_list
|
let has_active_stake = validator_list
|
||||||
.find::<ValidatorStakeInfo>(
|
.find::<ValidatorStakeInfo>(
|
||||||
&0u64.to_le_bytes(),
|
&0u64.to_le_bytes(),
|
||||||
ValidatorStakeInfo::memcmp_active_lamports,
|
ValidatorStakeInfo::active_lamports_not_equal,
|
||||||
)
|
)
|
||||||
.is_some();
|
.is_some();
|
||||||
|
|
||||||
|
@ -2209,7 +2209,7 @@ impl Processor {
|
||||||
let has_transient_stake = validator_list
|
let has_transient_stake = validator_list
|
||||||
.find::<ValidatorStakeInfo>(
|
.find::<ValidatorStakeInfo>(
|
||||||
&0u64.to_le_bytes(),
|
&0u64.to_le_bytes(),
|
||||||
ValidatorStakeInfo::memcmp_transient_lamports,
|
ValidatorStakeInfo::transient_lamports_not_equal,
|
||||||
)
|
)
|
||||||
.is_some();
|
.is_some();
|
||||||
if has_transient_stake || has_active_stake {
|
if has_transient_stake || has_active_stake {
|
||||||
|
|
|
@ -310,7 +310,7 @@ impl StakePool {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check staker validity and signature
|
/// Check mint is correct
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn check_mint(&self, mint_info: &AccountInfo) -> Result<(), ProgramError> {
|
pub(crate) fn check_mint(&self, mint_info: &AccountInfo) -> Result<(), ProgramError> {
|
||||||
if *mint_info.key != self.pool_mint {
|
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(
|
pub fn check_reserve_stake(
|
||||||
&self,
|
&self,
|
||||||
reserve_stake_info: &AccountInfo,
|
reserve_stake_info: &AccountInfo,
|
||||||
|
@ -528,14 +528,14 @@ impl ValidatorStakeInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs a very cheap comparison, for checking if this validator stake
|
/// Performs a very cheap comparison, for checking if this validator stake
|
||||||
/// info has active lamports equal to the given bytes
|
/// info does not have active lamports equal to the given bytes
|
||||||
pub fn memcmp_active_lamports(data: &[u8], lamports_le_bytes: &[u8]) -> bool {
|
pub fn active_lamports_not_equal(data: &[u8], lamports_le_bytes: &[u8]) -> bool {
|
||||||
sol_memcmp(&data[0..8], lamports_le_bytes, 8) != 0
|
sol_memcmp(&data[0..8], lamports_le_bytes, 8) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs a very cheap comparison, for checking if this validator stake
|
/// Performs a very cheap comparison, for checking if this validator stake
|
||||||
/// info has lamports equal to the given bytes
|
/// info does not have lamports equal to the given bytes
|
||||||
pub fn memcmp_transient_lamports(data: &[u8], lamports_le_bytes: &[u8]) -> bool {
|
pub fn transient_lamports_not_equal(data: &[u8], lamports_le_bytes: &[u8]) -> bool {
|
||||||
sol_memcmp(&data[8..16], lamports_le_bytes, 8) != 0
|
sol_memcmp(&data[8..16], lamports_le_bytes, 8) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue