Divorce the runtime from FeeCalculator (#20737)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
account::{AccountSharedData, ReadableAccount},
|
||||
account_utils::StateMut,
|
||||
fee_calculator::FeeCalculator,
|
||||
hash::Hash,
|
||||
nonce::{state::Versions, State},
|
||||
};
|
||||
@ -29,12 +28,12 @@ pub fn verify_nonce_account(acc: &AccountSharedData, hash: &Hash) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fee_calculator_of(account: &AccountSharedData) -> Option<FeeCalculator> {
|
||||
pub fn lamports_per_signature_of(account: &AccountSharedData) -> Option<u64> {
|
||||
let state = StateMut::<Versions>::state(account)
|
||||
.ok()?
|
||||
.convert_to_current();
|
||||
match state {
|
||||
State::Initialized(data) => Some(data.fee_calculator),
|
||||
State::Initialized(data) => Some(data.fee_calculator.lamports_per_signature),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user