Stop caching sysvars, instead load them ahead of time. (#21108)
This commit is contained in:
committed by
GitHub
parent
692cd5a2f8
commit
29ad081555
@ -1,6 +1,7 @@
|
||||
//! named accounts for synthesized data accounts for bank state, etc.
|
||||
//!
|
||||
use crate::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
pub mod clock;
|
||||
pub mod epoch_schedule;
|
||||
@ -13,18 +14,25 @@ pub mod slot_hashes;
|
||||
pub mod slot_history;
|
||||
pub mod stake_history;
|
||||
|
||||
#[allow(deprecated)]
|
||||
lazy_static! {
|
||||
pub static ref ALL_IDS: Vec<Pubkey> = vec![
|
||||
clock::id(),
|
||||
epoch_schedule::id(),
|
||||
#[allow(deprecated)]
|
||||
fees::id(),
|
||||
#[allow(deprecated)]
|
||||
recent_blockhashes::id(),
|
||||
rent::id(),
|
||||
rewards::id(),
|
||||
slot_hashes::id(),
|
||||
slot_history::id(),
|
||||
stake_history::id(),
|
||||
instructions::id(),
|
||||
];
|
||||
}
|
||||
|
||||
pub fn is_sysvar_id(id: &Pubkey) -> bool {
|
||||
clock::check_id(id)
|
||||
|| epoch_schedule::check_id(id)
|
||||
|| fees::check_id(id)
|
||||
|| recent_blockhashes::check_id(id)
|
||||
|| rent::check_id(id)
|
||||
|| rewards::check_id(id)
|
||||
|| slot_hashes::check_id(id)
|
||||
|| slot_history::check_id(id)
|
||||
|| stake_history::check_id(id)
|
||||
|| instructions::check_id(id)
|
||||
ALL_IDS.iter().any(|key| key == id)
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
|
Reference in New Issue
Block a user