prior to panicing with cap mismatch, try other calculation (#20292) (#20804)

(cherry picked from commit fa5b091b4c)

Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2021-10-20 02:26:23 +00:00
committed by GitHub
parent 6de9ef62e8
commit 63835ec214

View File

@ -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<Slot>,
) -> 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(),