cleanup some AccountSharedData::from(Account (#26120)
This commit is contained in:
parent
f534b8981b
commit
9db44ce352
|
@ -67,7 +67,7 @@ use {
|
|||
solana_measure::measure::Measure,
|
||||
solana_rayon_threadlimit::get_thread_count,
|
||||
solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount, WritableAccount},
|
||||
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
|
||||
clock::{BankId, Epoch, Slot, SlotCount},
|
||||
epoch_schedule::EpochSchedule,
|
||||
genesis_config::{ClusterType, GenesisConfig},
|
||||
|
@ -333,6 +333,12 @@ impl ZeroLamport for AccountSharedData {
|
|||
}
|
||||
}
|
||||
|
||||
impl ZeroLamport for Account {
|
||||
fn is_zero_lamport(&self) -> bool {
|
||||
self.lamports() == 0
|
||||
}
|
||||
}
|
||||
|
||||
struct MultiThreadProgress<'a> {
|
||||
last_update: Instant,
|
||||
my_last_report_count: u64,
|
||||
|
|
|
@ -3470,7 +3470,7 @@ impl Bank {
|
|||
"{} repeated in genesis config",
|
||||
pubkey
|
||||
);
|
||||
self.store_account(pubkey, &AccountSharedData::from(account.clone()));
|
||||
self.store_account(pubkey, account);
|
||||
self.capitalization.fetch_add(account.lamports(), Relaxed);
|
||||
}
|
||||
// updating sysvars (the fees sysvar in this case) now depends on feature activations in
|
||||
|
@ -3483,7 +3483,7 @@ impl Bank {
|
|||
"{} repeated in genesis config",
|
||||
pubkey
|
||||
);
|
||||
self.store_account(pubkey, &AccountSharedData::from(account.clone()));
|
||||
self.store_account(pubkey, account);
|
||||
}
|
||||
|
||||
// highest staked node is the first collector
|
||||
|
@ -6226,7 +6226,11 @@ impl Bank {
|
|||
parents
|
||||
}
|
||||
|
||||
pub fn store_account(&self, pubkey: &Pubkey, account: &AccountSharedData) {
|
||||
pub fn store_account<T: ReadableAccount + Sync + ZeroLamport>(
|
||||
&self,
|
||||
pubkey: &Pubkey,
|
||||
account: &T,
|
||||
) {
|
||||
self.store_accounts((self.slot(), &[(pubkey, account)][..]))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue