From bc65638475777e61acb6ba6240e57139ba8e561f Mon Sep 17 00:00:00 2001 From: bw-solana Date: Tue, 2 Jul 2024 23:53:35 +0000 Subject: [PATCH] use squash to add all roots --- 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 7698852ce3e849..06e85c558bbce6 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -2150,9 +2150,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(),