Add hash stats information to check hashes between validators (#7780)

automerge
This commit is contained in:
sakridge
2020-01-14 11:57:29 -08:00
committed by Grimes
parent 564cd4e09d
commit 3b78be83cf
3 changed files with 111 additions and 17 deletions

View File

@@ -1,4 +1,6 @@
use crate::accounts_db::{AccountInfo, AccountStorage, AccountsDB, AppendVecId, ErrorCounters};
use crate::accounts_db::{
AccountInfo, AccountStorage, AccountsDB, AppendVecId, BankHashInfo, ErrorCounters,
};
use crate::accounts_index::AccountsIndex;
use crate::append_vec::StoredAccount;
use crate::bank::{HashAgeKind, TransactionProcessResult};
@@ -487,10 +489,15 @@ impl Accounts {
}
pub fn bank_hash_at(&self, slot_id: Slot) -> BankHash {
self.bank_hash_info_at(slot_id).hash
}
pub fn bank_hash_info_at(&self, slot_id: Slot) -> BankHashInfo {
let bank_hashes = self.accounts_db.bank_hashes.read().unwrap();
*bank_hashes
bank_hashes
.get(&slot_id)
.expect("No bank hash was found for this bank, that should not be possible")
.clone()
}
/// This function will prevent multiple threads from modifying the same account state at the