Another some tower logging improvements (#12940)

This commit is contained in:
Ryo Onodera 2020-10-16 14:44:07 +09:00 committed by GitHub
parent 5a5b7f39c1
commit fd8ec27fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -570,9 +570,13 @@ impl Tower {
return SwitchForkDecision::SameFork;
}
// Should never consider switching to an ancestor
// of your last vote
assert!(!last_vote_ancestors.contains(&switch_slot));
assert!(
!last_vote_ancestors.contains(&switch_slot),
"Should never consider switching to slot ({}), which is ancestors({:?}) of last vote: {}",
switch_slot,
last_vote_ancestors,
last_voted_slot
);
// By this point, we know the `switch_slot` is on a different fork
// (is neither an ancestor nor descendant of `last_vote`), so a
@ -832,16 +836,17 @@ impl Tower {
replayed_root: Slot,
slot_history: &SlotHistory,
) -> Result<Self> {
info!(
"adjusting lockouts (after replay up to {}): {:?}",
replayed_root,
self.voted_slots()
);
// sanity assertions for roots
assert_eq!(slot_history.check(replayed_root), Check::Found);
assert!(self.root().is_some());
let tower_root = self.root().unwrap();
info!(
"adjusting lockouts (after replay up to {}): {:?} tower root: {}",
replayed_root,
self.voted_slots(),
tower_root,
);
assert_eq!(slot_history.check(replayed_root), Check::Found);
// reconcile_blockstore_roots_with_tower() should already have aligned these.
assert!(
tower_root <= replayed_root,