From b19fa360a3edbc7fa5f51ba207b9d6c78213fca1 Mon Sep 17 00:00:00 2001 From: Brennan Date: Tue, 6 Aug 2024 10:03:46 -0700 Subject: [PATCH] use squash to add all roots (#1981) --- ledger-tool/src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 78c36acf910ca7..1005f30a71cd65 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -2224,9 +2224,13 @@ fn main() { }; 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()); + // 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. Use squash to + // root all unrooted parents as well and avoid panicking + // during snapshot creation if we try to add roots out + // of order. + bank.squash(); bank.force_flush_accounts_cache(); Arc::new(Bank::warp_from_parent( bank.clone(),