From 9c42f9f30937c32793c1f09acd2f4c75a65cb1d0 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Mon, 1 Jul 2024 16:36:36 -0600 Subject: [PATCH] Remove dependent deprecated program-test methods --- program-test/src/lib.rs | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/program-test/src/lib.rs b/program-test/src/lib.rs index 58492d893aea80..f3c06d6b0fe94b 100644 --- a/program-test/src/lib.rs +++ b/program-test/src/lib.rs @@ -34,7 +34,7 @@ use { clock::{Epoch, Slot}, entrypoint::{deserialize, ProgramResult, SUCCESS}, feature_set::FEATURE_NAMES, - fee_calculator::{FeeCalculator, FeeRateGovernor, DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE}, + fee_calculator::{FeeRateGovernor, DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE}, genesis_config::{ClusterType, GenesisConfig}, hash::Hash, instruction::{Instruction, InstructionError}, @@ -973,47 +973,12 @@ impl ProgramTest { #[async_trait] pub trait ProgramTestBanksClientExt { - /// Get a new blockhash, similar in spirit to RpcClient::get_new_blockhash() - /// - /// This probably should eventually be moved into BanksClient proper in some form - #[deprecated( - since = "1.9.0", - note = "Please use `get_new_latest_blockhash `instead" - )] - async fn get_new_blockhash(&mut self, blockhash: &Hash) -> io::Result<(Hash, FeeCalculator)>; /// Get a new latest blockhash, similar in spirit to RpcClient::get_latest_blockhash() async fn get_new_latest_blockhash(&mut self, blockhash: &Hash) -> io::Result; } #[async_trait] impl ProgramTestBanksClientExt for BanksClient { - async fn get_new_blockhash(&mut self, blockhash: &Hash) -> io::Result<(Hash, FeeCalculator)> { - let mut num_retries = 0; - let start = Instant::now(); - while start.elapsed().as_secs() < 5 { - #[allow(deprecated)] - if let Ok((fee_calculator, new_blockhash, _slot)) = self.get_fees().await { - if new_blockhash != *blockhash { - return Ok((new_blockhash, fee_calculator)); - } - } - debug!("Got same blockhash ({:?}), will retry...", blockhash); - - tokio::time::sleep(Duration::from_millis(200)).await; - num_retries += 1; - } - - Err(io::Error::new( - io::ErrorKind::Other, - format!( - "Unable to get new blockhash after {}ms (retried {} times), stuck at {}", - start.elapsed().as_millis(), - num_retries, - blockhash - ), - )) - } - async fn get_new_latest_blockhash(&mut self, blockhash: &Hash) -> io::Result { let mut num_retries = 0; let start = Instant::now();