Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: move sysvar cache to new module
- Loading branch information
Showing
10 changed files
with
178 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use { | ||
super::Bank, | ||
solana_sdk::{ | ||
account::ReadableAccount, | ||
pubkey::Pubkey, | ||
sysvar::{self, Sysvar}, | ||
}, | ||
}; | ||
|
||
impl Bank { | ||
pub(crate) fn fill_sysvar_cache(&mut self) { | ||
let mut sysvar_cache = self.sysvar_cache.write().unwrap(); | ||
for id in sysvar::ALL_IDS.iter() { | ||
if !sysvar_cache.iter().any(|(key, _data)| key == id) { | ||
if let Some(account) = self.get_account_with_fixed_root(id) { | ||
sysvar_cache.push_entry(*id, account.data().to_vec()); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.