Uses set_accounts_{delta,}_hash_for_tests() in serde tests (#30390)

This commit is contained in:
Brooks 2023-02-17 16:00:25 -05:00 committed by GitHub
parent ee1717b24b
commit ad6a3abd8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View File

@ -9501,6 +9501,15 @@ pub mod tests {
pub fn set_accounts_hash_for_tests(&self, slot: Slot, accounts_hash: AccountsHash) {
self.set_accounts_hash(slot, accounts_hash);
}
// used by serde_snapshot tests
pub fn set_accounts_delta_hash_for_tests(
&self,
slot: Slot,
accounts_delta_hash: AccountsDeltaHash,
) {
self.set_accounts_delta_hash(slot, accounts_delta_hash);
}
}
/// This impl exists until this feature is activated:

View File

@ -188,7 +188,7 @@ fn test_accounts_serialize_style(serde_style: SerdeStyle) {
let accounts_hash = AccountsHash(Hash::new_unique());
accounts
.accounts_db
.set_accounts_hash_from_snapshot(slot, accounts_hash);
.set_accounts_hash_for_tests(slot, accounts_hash);
let mut writer = Cursor::new(vec![]);
accountsdb_to_stream(
@ -521,11 +521,11 @@ fn test_extra_fields_eof() {
bank.rc
.accounts
.accounts_db
.set_accounts_delta_hash_from_snapshot(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
.set_accounts_delta_hash_for_tests(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
bank.rc
.accounts
.accounts_db
.set_accounts_hash_from_snapshot(bank.slot(), AccountsHash(Hash::new_unique()));
.set_accounts_hash_for_tests(bank.slot(), AccountsHash(Hash::new_unique()));
// Set extra fields
bank.fee_rate_governor.lamports_per_signature = 7000;
@ -657,11 +657,11 @@ fn test_blank_extra_fields() {
bank.rc
.accounts
.accounts_db
.set_accounts_delta_hash_from_snapshot(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
.set_accounts_delta_hash_for_tests(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
bank.rc
.accounts
.accounts_db
.set_accounts_hash_from_snapshot(bank.slot(), AccountsHash(Hash::new_unique()));
.set_accounts_hash_for_tests(bank.slot(), AccountsHash(Hash::new_unique()));
// Set extra fields
bank.fee_rate_governor.lamports_per_signature = 7000;
@ -733,14 +733,11 @@ mod test_bank_serialize {
bank.rc
.accounts
.accounts_db
.set_accounts_delta_hash_from_snapshot(
bank.slot(),
AccountsDeltaHash(Hash::new_unique()),
);
.set_accounts_delta_hash_for_tests(bank.slot(), AccountsDeltaHash(Hash::new_unique()));
bank.rc
.accounts
.accounts_db
.set_accounts_hash_from_snapshot(bank.slot(), AccountsHash(Hash::new_unique()));
.set_accounts_hash_for_tests(bank.slot(), AccountsHash(Hash::new_unique()));
let snapshot_storages = bank
.rc
.accounts