Fix bank hash not changing when no internal state has changed (#7052)

* Fix bank hash not changing when no internal state has changed

* Fix unnecessary call to hash_internal_state

* Add blockhash into the bank_hash

* Add blockhash into the bank_hash and update tests

* Refactor accounts_db slot_hashes

* More clarity in comments

* Add clippy suggestion

* Grammar

* Fix compile after clippy made me break it

* Schooled by clippy
This commit is contained in:
Sagar Dhawan
2019-11-19 20:19:43 -08:00
committed by GitHub
parent d2ed921bc6
commit 42da1ce4e2
3 changed files with 46 additions and 43 deletions

View File

@@ -454,12 +454,7 @@ impl Accounts {
pub fn hash_internal_state(&self, slot_id: Slot) -> Option<BankHash> {
let slot_hashes = self.accounts_db.slot_hashes.read().unwrap();
let slot_hash = slot_hashes.get(&slot_id)?;
if slot_hash.0 {
Some(slot_hash.1)
} else {
None
}
slot_hashes.get(&slot_id).cloned()
}
/// This function will prevent multiple threads from modifying the same account state at the