Uses Storages to calculate accounts hash when warping in `ledger-tool create-snapshot` (#29194)
This commit is contained in:
parent
025b35af40
commit
e02d1670fb
|
@ -49,7 +49,7 @@ use {
|
||||||
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService,
|
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService,
|
||||||
PrunedBanksRequestHandler, SnapshotRequestHandler,
|
PrunedBanksRequestHandler, SnapshotRequestHandler,
|
||||||
},
|
},
|
||||||
accounts_db::{AccountsDbConfig, FillerAccountsConfig},
|
accounts_db::{AccountsDbConfig, CalcAccountsHashDataSource, FillerAccountsConfig},
|
||||||
accounts_index::{AccountsIndexConfig, IndexLimitMb, ScanConfig},
|
accounts_index::{AccountsIndexConfig, IndexLimitMb, ScanConfig},
|
||||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||||
bank::{Bank, RewardCalculationEvent, TotalAccountsStats},
|
bank::{Bank, RewardCalculationEvent, TotalAccountsStats},
|
||||||
|
@ -3225,11 +3225,15 @@ fn main() {
|
||||||
bank.set_capitalization();
|
bank.set_capitalization();
|
||||||
|
|
||||||
let bank = if let Some(warp_slot) = warp_slot {
|
let bank = if let Some(warp_slot) = warp_slot {
|
||||||
|
// need to flush the write cache in order to use Storages to calculate
|
||||||
|
// the accounts hash, and need to root `bank` before flushing the cache
|
||||||
|
bank.rc.accounts.accounts_db.add_root(bank.slot());
|
||||||
|
bank.force_flush_accounts_cache();
|
||||||
Arc::new(Bank::warp_from_parent(
|
Arc::new(Bank::warp_from_parent(
|
||||||
&bank,
|
&bank,
|
||||||
bank.collector_id(),
|
bank.collector_id(),
|
||||||
warp_slot,
|
warp_slot,
|
||||||
solana_runtime::accounts_db::CalcAccountsHashDataSource::IndexForTests,
|
CalcAccountsHashDataSource::Storages,
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
bank
|
bank
|
||||||
|
|
Loading…
Reference in New Issue