From 63835ec214404b3e8c5aac140d0a3b92f94fa222 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 20 Oct 2021 02:26:23 +0000 Subject: [PATCH] prior to panicing with cap mismatch, try other calculation (#20292) (#20804) (cherry picked from commit fa5b091b4c2064bd865bfb32154c395dab2f56a7) Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com> --- runtime/src/bank.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index a6d7259563..59e6343b67 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5222,7 +5222,7 @@ impl Bank { pub fn update_accounts_hash_with_index_option( &self, use_index: bool, - debug_verify: bool, + mut debug_verify: bool, slots_per_epoch: Option, ) -> Hash { let (hash, total_lamports) = self @@ -5246,6 +5246,24 @@ impl Bank { ("capitalization", self.capitalization(), i64), ); + if !debug_verify { + // cap mismatch detected. It has been logged to metrics above. + // Run both versions of the calculation to attempt to get more info. + debug_verify = true; + self.rc + .accounts + .accounts_db + .update_accounts_hash_with_index_option( + use_index, + debug_verify, + self.slot(), + &self.ancestors, + Some(self.capitalization()), + false, + slots_per_epoch, + ); + } + panic!( "capitalization_mismatch. slot: {}, calculated_lamports: {}, capitalization: {}", self.slot(),