Skip to content

Commit

Permalink
fix issue #568
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-solana authored and garious committed Jul 10, 2018
1 parent 922dffb commit 1dd467e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ impl Bank {
if tail.len() < WINDOW_SIZE as usize {
tail.insert(0, entry0);
}
} else if tail.len() > WINDOW_SIZE as usize {
tail = tail[tail.len() - WINDOW_SIZE as usize..].to_vec();
}

Ok((entry_count, tail))
Expand Down Expand Up @@ -773,7 +775,7 @@ mod tests {
#[test]
fn test_process_ledger_around_window_size() {
let window_size = WINDOW_SIZE as usize;
for entry_count in window_size - 1..window_size + 1 {
for entry_count in window_size - 1..window_size + 3 {
let (ledger, pubkey) = create_sample_ledger(entry_count);
let bank = Bank::default();
let (ledger_height, tail) = bank.process_ledger(ledger).unwrap();
Expand Down

0 comments on commit 1dd467e

Please sign in to comment.