Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 6c9da95

Browse files
committed
dcou: set_accounts_hash()
1 parent 7b804e3 commit 6c9da95

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

accounts-db/src/accounts_db.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7445,7 +7445,8 @@ impl AccountsDb {
74457445
/// Set the accounts hash for `slot`
74467446
///
74477447
/// returns the previous accounts hash for `slot`
7448-
pub fn set_accounts_hash(
7448+
#[cfg_attr(feature = "dev-context-only-utils", fn_qualifiers(pub))]
7449+
fn set_accounts_hash(
74497450
&self,
74507451
slot: Slot,
74517452
accounts_hash: (AccountsHash, /*capitalization*/ u64),
@@ -9604,10 +9605,6 @@ impl AccountsDb {
96049605
&self.accounts_hashes
96059606
}
96069607

9607-
pub fn set_accounts_hash_for_tests(&self, slot: Slot, accounts_hash: AccountsHash) {
9608-
self.set_accounts_hash(slot, (accounts_hash, u64::default()));
9609-
}
9610-
96119608
pub fn assert_load_account(&self, slot: Slot, pubkey: Pubkey, expected_lamports: u64) {
96129609
let ancestors = vec![(slot, 0)].into_iter().collect();
96139610
let (account, slot) = self.load_without_fixed_root(&ancestors, &pubkey).unwrap();

runtime/src/bank/serde_snapshot.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ mod tests {
131131
bank2.freeze();
132132
bank2.squash();
133133
bank2.force_flush_accounts_cache();
134-
bank2
135-
.accounts()
136-
.accounts_db
137-
.set_accounts_hash_for_tests(bank2.slot(), AccountsHash(Hash::new(&[0; 32])));
134+
bank2.accounts().accounts_db.set_accounts_hash(
135+
bank2.slot(),
136+
(AccountsHash(Hash::new(&[0; 32])), u64::default()),
137+
);
138138

139139
let snapshot_storages = bank2.get_snapshot_storages(None);
140140
let mut buf = vec![];
@@ -164,10 +164,10 @@ mod tests {
164164
.unwrap();
165165

166166
if update_accounts_hash {
167-
bank2
168-
.accounts()
169-
.accounts_db
170-
.set_accounts_hash_for_tests(bank2.slot(), AccountsHash(Hash::new(&[1; 32])));
167+
bank2.accounts().accounts_db.set_accounts_hash(
168+
bank2.slot(),
169+
(AccountsHash(Hash::new(&[1; 32])), u64::default()),
170+
);
171171
}
172172
let accounts_hash = bank2.get_accounts_hash().unwrap();
173173

@@ -353,10 +353,10 @@ mod tests {
353353
.accounts
354354
.accounts_db
355355
.set_accounts_delta_hash(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
356-
bank.rc
357-
.accounts
358-
.accounts_db
359-
.set_accounts_hash_for_tests(bank.slot(), AccountsHash(Hash::new_unique()));
356+
bank.rc.accounts.accounts_db.set_accounts_hash(
357+
bank.slot(),
358+
(AccountsHash(Hash::new_unique()), u64::default()),
359+
);
360360

361361
// Set extra fields
362362
bank.fee_rate_governor.lamports_per_signature = 7000;
@@ -544,10 +544,10 @@ mod tests {
544544
.accounts
545545
.accounts_db
546546
.set_accounts_delta_hash(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
547-
bank.rc
548-
.accounts
549-
.accounts_db
550-
.set_accounts_hash_for_tests(bank.slot(), AccountsHash(Hash::new_unique()));
547+
bank.rc.accounts.accounts_db.set_accounts_hash(
548+
bank.slot(),
549+
(AccountsHash(Hash::new_unique()), u64::default()),
550+
);
551551

552552
// Set extra fields
553553
bank.fee_rate_governor.lamports_per_signature = 7000;
@@ -626,10 +626,10 @@ mod tests {
626626
.accounts
627627
.accounts_db
628628
.set_accounts_delta_hash(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
629-
bank.rc
630-
.accounts
631-
.accounts_db
632-
.set_accounts_hash_for_tests(bank.slot(), AccountsHash(Hash::new_unique()));
629+
bank.rc.accounts.accounts_db.set_accounts_hash(
630+
bank.slot(),
631+
(AccountsHash(Hash::new_unique()), u64::default()),
632+
);
633633
let snapshot_storages = bank.rc.accounts.accounts_db.get_snapshot_storages(..=0).0;
634634
// ensure there is a single snapshot storage example for ABI digesting
635635
assert_eq!(snapshot_storages.len(), 1);

runtime/src/serde_snapshot/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ mod serde_snapshot_tests {
239239
let accounts_hash = AccountsHash(Hash::new_unique());
240240
accounts
241241
.accounts_db
242-
.set_accounts_hash_for_tests(slot, accounts_hash);
242+
.set_accounts_hash(slot, (accounts_hash, u64::default()));
243243

244244
let mut writer = Cursor::new(vec![]);
245245
accountsdb_to_stream(

0 commit comments

Comments
 (0)