diff --git a/src/state_engine/engine.rs b/src/state_engine/engine.rs index a81fd30..57571b4 100644 --- a/src/state_engine/engine.rs +++ b/src/state_engine/engine.rs @@ -1,7 +1,7 @@ use solana_account_decoder::UiAccountEncoding; use solana_account_decoder::UiDataSliceConfig; use solana_sdk::bs58; -use std::{str::FromStr, sync::Arc}; +use std::sync::Arc; use anchor_client::anchor_lang::AccountDeserialize; use anchor_client::anchor_lang::Discriminator; @@ -211,7 +211,7 @@ impl StateEngineService { .entry(*bank_address) .and_modify(|bank_entry| match bank_entry.try_write() { Ok(mut bank_wg) => { - bank_wg.bank = bank.clone(); + bank_wg.bank = *bank; } Err(e) => { error!("Failed to acquire write lock on bank: {}", e); @@ -220,7 +220,7 @@ impl StateEngineService { .or_insert_with(|| { Arc::new(RwLock::new(BankWrapper::new( *bank_address, - bank.clone(), + *bank, OracleWrapper::new( **oracle_address, OraclePriceFeedAdapter::try_from_bank_config( @@ -281,7 +281,7 @@ impl StateEngineService { .entry(*bank_address) .and_modify(|bank_entry| { if let Ok(mut bank_entry) = bank_entry.try_write() { - bank_entry.bank = bank.clone(); + bank_entry.bank = *bank; } else { warn!("Failed to acquire write lock on bank, bank update skipped"); } @@ -297,7 +297,7 @@ impl StateEngineService { Arc::new(RwLock::new(BankWrapper::new( *bank_address, - bank.clone(), + *bank, OracleWrapper::new( oracle_address, OraclePriceFeedAdapter::try_from_bank_config( @@ -327,7 +327,7 @@ impl StateEngineService { for mint in bank_mints.iter() { let ata = spl_associated_token_account::get_associated_token_address( &self.config.signer_pubkey, - &mint, + mint, ); token_account_addresses.push(ata); } @@ -508,7 +508,7 @@ impl StateEngineService { .entry(*marginfi_account_address) .and_modify(|marginfi_account_ref| { let marginfi_account_ref = Arc::clone(marginfi_account_ref); - let marginfi_account_updated = marginfi_account.clone(); + let marginfi_account_updated = *marginfi_account; tokio::spawn(async move { let mut marginfi_account_guard = marginfi_account_ref.write().await; marginfi_account_guard.account = marginfi_account_updated; @@ -517,7 +517,7 @@ impl StateEngineService { .or_insert_with(|| { Arc::new(RwLock::new(MarginfiAccountWrapper::new( *marginfi_account_address, - marginfi_account.clone(), + *marginfi_account, Vec::new(), ))) }); @@ -529,7 +529,7 @@ impl StateEngineService { let marginfi_accounts = self.marginfi_accounts.clone(); for account_ref in marginfi_accounts.iter() { let account = account_ref.value().read().await; - let marginfi_account = account.account.clone(); // clone the underlying data + let marginfi_account = account.account; // clone the underlying data let address = account.address; // get the address from the account let update_tasks = self.update_tasks.lock().await; diff --git a/src/state_engine/geyser.rs b/src/state_engine/geyser.rs index 380fea6..e04f93f 100644 --- a/src/state_engine/geyser.rs +++ b/src/state_engine/geyser.rs @@ -163,7 +163,7 @@ impl GeyserService { if let Ok(account_owner_pk) = Pubkey::try_from(account.owner.clone()) { if account_owner_pk == state_engine.get_marginfi_program_id() { let maybe_update = - Self::process_marginfi_account_update(state_engine, &account)?; + Self::process_marginfi_account_update(state_engine, account)?; if let Some(update) = maybe_update { geyser_update_request.merge(update); } @@ -173,12 +173,12 @@ impl GeyserService { if let Ok(address) = Pubkey::try_from(account.pubkey.clone()) { if state_engine.is_tracked_oracle(&address) { - Self::process_oracle_account_update(state_engine, &account)?; + Self::process_oracle_account_update(state_engine, account)?; processed = true; } if state_engine.is_tracked_token_account(&address) { - Self::process_token_account_update(state_engine, &account)?; + Self::process_token_account_update(state_engine, account)?; processed = true; } } @@ -252,8 +252,8 @@ impl GeyserService { Ok(()) } fn process_token_account_update( - state_engine: &Arc, - account_update: &SubscribeUpdateAccountInfo, + _state_engine: &Arc, + _account_update: &SubscribeUpdateAccountInfo, ) -> Result<(), GeyserServiceError> { Ok(()) }