Skip to content

Commit

Permalink
Returns Self instead of Result<Self> for AccountsPackage::new_for_sna…
Browse files Browse the repository at this point in the history
…pshot() (solana-labs#32545)
  • Loading branch information
brooksprumo authored Jul 20, 2023
1 parent 3fbfac4 commit 979913e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions core/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ fn run_bank_forks_snapshot_n<F>(
snapshot_config.archive_format,
snapshot_version,
None,
)
.unwrap();
);
last_bank.force_flush_accounts_cache();
let accounts_hash =
last_bank.update_accounts_hash(CalcAccountsHashDataSource::Storages, false, false);
Expand Down Expand Up @@ -418,8 +417,7 @@ fn test_concurrent_snapshot_packaging(
snapshot_config.archive_format,
snapshot_config.snapshot_version,
None,
)
.unwrap();
);
accounts_package_sender.send(accounts_package).unwrap();

bank_forks.insert(bank);
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/accounts_background_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl SnapshotRequestHandler {
self.snapshot_config.archive_format,
self.snapshot_config.snapshot_version,
accounts_hash_for_testing,
)?
)
}
SnapshotRequestType::EpochAccountsHash => {
// skip the bank snapshot, just make an accounts package to send to AHV
Expand Down
8 changes: 4 additions & 4 deletions runtime/src/snapshot_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
rent_collector::RentCollector,
snapshot_archive_info::{SnapshotArchiveInfo, SnapshotArchiveInfoGetter},
snapshot_hash::SnapshotHash,
snapshot_utils::{self, ArchiveFormat, BankSnapshotInfo, Result, SnapshotVersion},
snapshot_utils::{self, ArchiveFormat, BankSnapshotInfo, SnapshotVersion},
},
log::*,
solana_sdk::{clock::Slot, feature_set, sysvar::epoch_schedule::EpochSchedule},
Expand Down Expand Up @@ -57,7 +57,7 @@ impl AccountsPackage {
archive_format: ArchiveFormat,
snapshot_version: SnapshotVersion,
accounts_hash_for_testing: Option<AccountsHash>,
) -> Result<Self> {
) -> Self {
if let AccountsPackageType::Snapshot(snapshot_type) = package_type {
info!(
"Package snapshot for bank {} has {} account storage entries (snapshot type: {:?})",
Expand All @@ -84,13 +84,13 @@ impl AccountsPackage {
.to_path_buf(),
epoch_accounts_hash: bank.get_epoch_accounts_hash_to_serialize(),
};
Ok(Self::_new(
Self::_new(
package_type,
bank,
snapshot_storages,
accounts_hash_for_testing,
Some(snapshot_info),
))
)
}

/// Package up fields needed to compute an EpochAccountsHash
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,7 @@ pub fn package_and_archive_full_snapshot(
archive_format,
snapshot_version,
None,
)?;
);

let accounts_hash = bank
.get_accounts_hash()
Expand Down Expand Up @@ -3194,7 +3194,7 @@ pub fn package_and_archive_incremental_snapshot(
archive_format,
snapshot_version,
None,
)?;
);

let (accounts_hash_enum, accounts_hash_for_reserialize, bank_incremental_snapshot_persistence) =
if bank
Expand Down

0 comments on commit 979913e

Please sign in to comment.