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:
@ -145,10 +145,22 @@ impl VoteState {
|
|||||||
.iter()
|
.iter()
|
||||||
.any(|(slot, hash)| vote.slot == *slot && vote.hash == *hash)
|
.any(|(slot, hash)| vote.slot == *slot && vote.hash == *hash)
|
||||||
{
|
{
|
||||||
warn!(
|
if log_enabled!(log::Level::Warn) {
|
||||||
"dropping vote {:?}, no matching slot/hash combination",
|
for (slot, hash) in slot_hashes {
|
||||||
vote
|
if vote.slot == *slot {
|
||||||
);
|
warn!(
|
||||||
|
"dropped vote {:?} matched slot {}, but not hash {:?}",
|
||||||
|
vote, *slot, *hash
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if vote.hash == *hash {
|
||||||
|
warn!(
|
||||||
|
"dropped vote {:?} matched hash {:?}, but not slot {}",
|
||||||
|
vote, *hash, *slot,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,18 +215,22 @@ impl Bank {
|
|||||||
self.store(&slot_hashes::id(), &account);
|
self.store(&slot_hashes::id(), &account);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_hash(&self) {
|
fn set_hash(&self) -> bool {
|
||||||
let mut hash = self.hash.write().unwrap();
|
let mut hash = self.hash.write().unwrap();
|
||||||
|
|
||||||
if *hash == Hash::default() {
|
if *hash == Hash::default() {
|
||||||
// freeze is a one-way trip, idempotent
|
// freeze is a one-way trip, idempotent
|
||||||
*hash = self.hash_internal_state();
|
*hash = self.hash_internal_state();
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn freeze(&self) {
|
pub fn freeze(&self) {
|
||||||
self.set_hash();
|
if self.set_hash() {
|
||||||
self.update_slot_hashes();
|
self.update_slot_hashes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn epoch_schedule(&self) -> &EpochSchedule {
|
pub fn epoch_schedule(&self) -> &EpochSchedule {
|
||||||
|
Reference in New Issue
Block a user