diff --git a/staking/programs/integrity-pool/src/state/pool.rs b/staking/programs/integrity-pool/src/state/pool.rs index 778ef0d4..a5d0a70f 100644 --- a/staking/programs/integrity-pool/src/state/pool.rs +++ b/staking/programs/integrity-pool/src/state/pool.rs @@ -204,7 +204,10 @@ impl PoolData { let mut i = 0; while i < MAX_PUBLISHERS && self.publishers[i] != Pubkey::default() { - let cap_index = Self::get_publisher_cap_index(&self.publishers[i], publisher_caps); + let cap_index = publisher_caps + .caps() + .binary_search_by_key(&self.publishers[i], |cap| cap.pubkey); + let publisher_cap = match cap_index { Ok(cap_index) => { @@ -264,19 +267,6 @@ impl PoolData { Ok(()) } - fn get_publisher_cap_index( - publisher: &Pubkey, - publisher_caps: &PublisherCaps, - ) -> Result { - if *publisher == Pubkey::default() { - return Err(IntegrityPoolError::ThisCodeShouldBeUnreachable.into()); - } - publisher_caps - .caps() - .binary_search_by_key(&publisher, |cap| &cap.pubkey) - .map_err(|_| IntegrityPoolError::PublisherNotFound.into()) - } - pub fn create_reward_events_for_publisher( &mut self, epoch_from: u64,