Deprecate FeeCalculator returning APIs (#19120)

This commit is contained in:
Jack May
2021-08-13 09:08:20 -07:00
committed by GitHub
parent 26e963f436
commit 0b50bb2b20
47 changed files with 1119 additions and 463 deletions

View File

@ -27,11 +27,15 @@ impl FeeCalculator {
}
}
#[deprecated(
since = "1.8.0",
note = "Please do not use, will no longer be available in the future"
)]
pub fn calculate_fee(&self, message: &Message) -> u64 {
let mut num_secp256k1_signatures: u64 = 0;
for instruction in &message.instructions {
let program_index = instruction.program_id_index as usize;
// Transaction may not be sanitized here
// Message may not be sanitized here
if program_index < message.account_keys.len() {
let id = message.account_keys[program_index];
if secp256k1_program::check_id(&id) && !instruction.data.is_empty() {
@ -193,6 +197,7 @@ mod tests {
}
#[test]
#[allow(deprecated)]
fn test_fee_calculator_calculate_fee() {
// Default: no fee.
let message = Message::default();
@ -216,6 +221,7 @@ mod tests {
}
#[test]
#[allow(deprecated)]
fn test_fee_calculator_calculate_fee_secp256k1() {
use crate::instruction::Instruction;
let pubkey0 = Pubkey::new(&[0; 32]);