Skip to content

Commit

Permalink
Remove deprecated Banks client/interface methods
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Jul 1, 2024
1 parent 1cf61c9 commit c9565fa
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 69 deletions.
43 changes: 1 addition & 42 deletions banks-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use {
BanksTransactionResultWithSimulation,
},
solana_program::{
clock::Slot, fee_calculator::FeeCalculator, hash::Hash, program_pack::Pack, pubkey::Pubkey,
rent::Rent, sysvar::Sysvar,
clock::Slot, hash::Hash, program_pack::Pack, pubkey::Pubkey, rent::Rent, sysvar::Sysvar,
},
solana_sdk::{
account::{from_account, Account},
Expand Down Expand Up @@ -69,21 +68,6 @@ impl BanksClient {
.map_err(Into::into)
}

#[deprecated(
since = "1.9.0",
note = "Please use `get_fee_for_message` or `is_blockhash_valid` instead"
)]
pub fn get_fees_with_commitment_and_context(
&mut self,
ctx: Context,
commitment: CommitmentLevel,
) -> impl Future<Output = Result<(FeeCalculator, Hash, u64), BanksClientError>> + '_ {
#[allow(deprecated)]
self.inner
.get_fees_with_commitment_and_context(ctx, commitment)
.map_err(Into::into)
}

pub fn get_transaction_status_with_context(
&mut self,
ctx: Context,
Expand Down Expand Up @@ -185,20 +169,6 @@ impl BanksClient {
self.send_transaction_with_context(context::current(), transaction.into())
}

/// Return the fee parameters associated with a recent, rooted blockhash. The cluster
/// will use the transaction's blockhash to look up these same fee parameters and
/// use them to calculate the transaction fee.
#[deprecated(
since = "1.9.0",
note = "Please use `get_fee_for_message` or `is_blockhash_valid` instead"
)]
pub fn get_fees(
&mut self,
) -> impl Future<Output = Result<(FeeCalculator, Hash, u64), BanksClientError>> + '_ {
#[allow(deprecated)]
self.get_fees_with_commitment_and_context(context::current(), CommitmentLevel::default())
}

/// Return the cluster Sysvar
pub fn get_sysvar<T: Sysvar>(
&mut self,
Expand All @@ -216,17 +186,6 @@ impl BanksClient {
self.get_sysvar::<Rent>()
}

/// Return a recent, rooted blockhash from the server. The cluster will only accept
/// transactions with a blockhash that has not yet expired. Use the `get_fees`
/// method to get both a blockhash and the blockhash's last valid slot.
#[deprecated(since = "1.9.0", note = "Please use `get_latest_blockhash` instead")]
pub fn get_recent_blockhash(
&mut self,
) -> impl Future<Output = Result<Hash, BanksClientError>> + '_ {
#[allow(deprecated)]
self.get_fees().map(|result| Ok(result?.1))
}

/// Send a transaction and return after the transaction has been rejected or
/// reached the given level of commitment.
pub fn process_transaction_with_commitment(
Expand Down
8 changes: 0 additions & 8 deletions banks-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use {
account::Account,
clock::Slot,
commitment_config::CommitmentLevel,
fee_calculator::FeeCalculator,
hash::Hash,
inner_instruction::InnerInstructions,
message::Message,
Expand Down Expand Up @@ -64,13 +63,6 @@ pub struct BanksTransactionResultWithMetadata {
#[tarpc::service]
pub trait Banks {
async fn send_transaction_with_context(transaction: VersionedTransaction);
#[deprecated(
since = "1.9.0",
note = "Please use `get_fee_for_message_with_commitment_and_context` instead"
)]
async fn get_fees_with_commitment_and_context(
commitment: CommitmentLevel,
) -> (FeeCalculator, Hash, Slot);
async fn get_transaction_status_with_context(signature: Signature)
-> Option<TransactionStatus>;
async fn get_slot_with_context(commitment: CommitmentLevel) -> Slot;
Expand Down
19 changes: 0 additions & 19 deletions banks-server/src/banks_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use {
clock::Slot,
commitment_config::CommitmentLevel,
feature_set::FeatureSet,
fee_calculator::FeeCalculator,
hash::Hash,
message::{Message, SanitizedMessage},
pubkey::Pubkey,
Expand Down Expand Up @@ -232,24 +231,6 @@ impl Banks for BanksServer {
self.transaction_sender.send(info).unwrap();
}

async fn get_fees_with_commitment_and_context(
self,
_: Context,
commitment: CommitmentLevel,
) -> (FeeCalculator, Hash, u64) {
let bank = self.bank(commitment);
let blockhash = bank.last_blockhash();
let lamports_per_signature = bank.get_lamports_per_signature();
let last_valid_block_height = bank
.get_blockhash_last_valid_block_height(&blockhash)
.unwrap();
(
FeeCalculator::new(lamports_per_signature),
blockhash,
last_valid_block_height,
)
}

async fn get_transaction_status_with_context(
self,
_: Context,
Expand Down

0 comments on commit c9565fa

Please sign in to comment.