Fix potential crash in banking stage

This commit is contained in:
Pankaj Garg 2019-03-19 11:49:06 -07:00 committed by Grimes
parent 56fcc93ef5
commit 1be7ee51be
1 changed files with 3 additions and 1 deletions

View File

@ -150,7 +150,9 @@ impl BankingStage {
// Buffer the packets if I am the next leader
// or, if it was getting sent to me
let leader_id = match poh_recorder.lock().unwrap().bank() {
Some(bank) => leader_schedule_utils::slot_leader_at(bank.slot() + 1, &bank).unwrap(),
Some(bank) => {
leader_schedule_utils::slot_leader_at(bank.slot() + 1, &bank).unwrap_or_default()
}
None => rcluster_info
.leader_data()
.map(|x| x.id)