check freeze before updating slot_hashes (#4448)
* check freeze before updating slot_hashes * fixup
This commit is contained in:
parent
ff31ffbd54
commit
441fed7a5b
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue