This commit is contained in:
Rob Walker 2019-09-24 10:10:49 -07:00 committed by GitHub
parent b6a8268da3
commit 26a20a7e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -22,24 +22,24 @@ const RECEIVE_ENTRY_COUNT_THRESHOLD: usize = 8;
pub(super) fn recv_slot_entries(receiver: &Receiver<WorkingBankEntry>) -> Result<ReceiveResults> {
let timer = Duration::new(1, 0);
let (mut current_bank, (entry, mut last_tick)) = receiver.recv_timeout(timer)?;
let (mut bank, (entry, mut last_tick)) = receiver.recv_timeout(timer)?;
let recv_start = Instant::now();
let mut entries = vec![entry];
let mut slot = current_bank.slot();
let mut max_tick_height = current_bank.max_tick_height();
let mut slot = bank.slot();
let mut max_tick_height = bank.max_tick_height();
assert!(last_tick <= max_tick_height);
if last_tick != max_tick_height {
while let Ok((bank, (entry, tick_height))) = receiver.try_recv() {
while let Ok((try_bank, (entry, tick_height))) = receiver.try_recv() {
// If the bank changed, that implies the previous slot was interrupted and we do not have to
// broadcast its entries.
if bank.slot() != slot {
if try_bank.slot() != slot {
entries.clear();
bank = try_bank;
slot = bank.slot();
max_tick_height = bank.max_tick_height();
current_bank = bank;
}
last_tick = tick_height;
entries.push(entry);
@ -59,7 +59,7 @@ pub(super) fn recv_slot_entries(receiver: &Receiver<WorkingBankEntry>) -> Result
Ok(ReceiveResults {
entries,
time_elapsed,
bank: current_bank,
bank,
last_tick,
})
}