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

This commit is contained in:
Jeff Washington (jwash) 2021-09-28 16:09:36 -05:00 committed by GitHub
parent 271381628b
commit fa5b091b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

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