From fa5b091b4c2064bd865bfb32154c395dab2f56a7 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Tue, 28 Sep 2021 16:09:36 -0500 Subject: [PATCH] prior to panicing with cap mismatch, try other calculation (#20292) --- 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 6afc5d0260..dcb636b439 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -5010,7 +5010,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 @@ -5034,6 +5034,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(),