Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
prior to panicing with cap mismatch, try other calculation (#20292)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington authored Sep 28, 2021
1 parent 2713816 commit fa5b091
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand Down

0 comments on commit fa5b091

Please sign in to comment.