adds logs when push-vote panics with invalid vote-index (#19485)
In order to debug this panic on the clusters: panicked at 'assertion failed: (vote_index as usize) < MAX_LOCKOUT_HISTORY', core/src/cluster_info.rs:1012:9
This commit is contained in:
parent
b742af4034
commit
d7051b0d21
|
@ -67,7 +67,9 @@ use {
|
||||||
socket::SocketAddrSpace,
|
socket::SocketAddrSpace,
|
||||||
streamer::{PacketReceiver, PacketSender},
|
streamer::{PacketReceiver, PacketSender},
|
||||||
},
|
},
|
||||||
solana_vote_program::vote_state::MAX_LOCKOUT_HISTORY,
|
solana_vote_program::{
|
||||||
|
vote_state::MAX_LOCKOUT_HISTORY, vote_transaction::parse_vote_transaction,
|
||||||
|
},
|
||||||
std::{
|
std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::{hash_map::Entry, HashMap, HashSet, VecDeque},
|
collections::{hash_map::Entry, HashMap, HashSet, VecDeque},
|
||||||
|
@ -1004,6 +1006,16 @@ impl ClusterInfo {
|
||||||
.map(|(_ /*wallclock*/, ix)| ix)
|
.map(|(_ /*wallclock*/, ix)| ix)
|
||||||
};
|
};
|
||||||
let vote_index = vote_index.unwrap_or(num_crds_votes);
|
let vote_index = vote_index.unwrap_or(num_crds_votes);
|
||||||
|
if (vote_index as usize) >= MAX_LOCKOUT_HISTORY {
|
||||||
|
let (_, vote, hash) = parse_vote_transaction(&vote).unwrap();
|
||||||
|
panic!(
|
||||||
|
"invalid vote index: {}, switch: {}, vote slots: {:?}, tower: {:?}",
|
||||||
|
vote_index,
|
||||||
|
hash.is_some(),
|
||||||
|
vote.slots,
|
||||||
|
tower
|
||||||
|
);
|
||||||
|
}
|
||||||
self.push_vote_at_index(vote, vote_index);
|
self.push_vote_at_index(vote, vote_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue