Cherry pick fix for freeze (#4459)

* check freeze before updating slot_hashes (#4448)

* check freeze before updating slot_hashes

* fixup

* add more information to dropped vote warning (#4449)

* add more information to dropped vote warning

* fixup
This commit is contained in:
Rob Walker
2019-05-28 19:35:54 -07:00
committed by Dan Albert
parent b9b541441b
commit b4adb1c266
2 changed files with 23 additions and 7 deletions

View File

@@ -215,18 +215,22 @@ impl Bank {
self.store(&slot_hashes::id(), &account);
}
fn set_hash(&self) {
fn set_hash(&self) -> bool {
let mut hash = self.hash.write().unwrap();
if *hash == Hash::default() {
// freeze is a one-way trip, idempotent
*hash = self.hash_internal_state();
true
} else {
false
}
}
pub fn freeze(&self) {
self.set_hash();
self.update_slot_hashes();
if self.set_hash() {
self.update_slot_hashes();
}
}
pub fn epoch_schedule(&self) -> &EpochSchedule {