diff --git a/src/blocktree_processor.rs b/src/blocktree_processor.rs index 77c2214159..4ccbbde15c 100644 --- a/src/blocktree_processor.rs +++ b/src/blocktree_processor.rs @@ -123,6 +123,7 @@ pub struct BankForksInfo { pub bank_id: u64, pub entry_height: u64, pub last_entry_id: Hash, + pub next_blob_index: u64, } pub fn process_blocktree( @@ -166,7 +167,6 @@ pub fn process_blocktree( BankError::LedgerVerificationFailed })? .unwrap(); - trace!("processing slot {:?}, meta={:?}", slot, meta); // Fetch all entries for this slot let mut entries = blocktree.get_slot_entries(slot, 0, None).map_err(|err| { @@ -210,11 +210,19 @@ pub fn process_blocktree( match meta.next_slots.len() { 0 => { + let next_blob_index = { + if meta.is_full() { + 0 + } else { + meta.consumed + } + }; // Reached the end of this fork. Record the final entry height and last entry id bank_forks_info.push(BankForksInfo { bank_id, entry_height, last_entry_id, + next_blob_index, }) } 1 => pending_slots.push((meta.next_slots[0], bank_id, entry_height, last_entry_id)), @@ -328,6 +336,7 @@ mod tests { bank_id: 2, // Fork 1 diverged with slot 2 entry_height: ticks_per_slot * 4, last_entry_id: last_fork1_entry_id, + next_blob_index: 0, } ); assert_eq!( @@ -336,6 +345,7 @@ mod tests { bank_id: 4, // Fork 2 diverged with slot 4 entry_height: ticks_per_slot * 3, last_entry_id: last_fork2_entry_id, + next_blob_index: 0, } ); @@ -454,6 +464,7 @@ mod tests { bank_id: 0, entry_height, last_entry_id, + next_blob_index: entry_height, } ); diff --git a/src/replay_stage.rs b/src/replay_stage.rs index f233a05952..0997313d7d 100644 --- a/src/replay_stage.rs +++ b/src/replay_stage.rs @@ -201,7 +201,7 @@ impl ReplayStage { bank, tick_height, bank_forks_info[0].last_entry_id, - bank_forks_info[0].entry_height, + bank_forks_info[0].next_blob_index, ) }; diff --git a/src/tvu.rs b/src/tvu.rs index 44d4dae94a..0552885b54 100644 --- a/src/tvu.rs +++ b/src/tvu.rs @@ -226,6 +226,7 @@ pub mod tests { bank_id: 0, entry_height: 0, last_entry_id: Hash::default(), + next_blob_index: 0, }]; let leader_scheduler = LeaderScheduler::new_with_bank(&bank_forks.working_bank()); let leader_scheduler = Arc::new(RwLock::new(leader_scheduler)); diff --git a/tests/tvu.rs b/tests/tvu.rs index 672833331b..153b12c8ec 100644 --- a/tests/tvu.rs +++ b/tests/tvu.rs @@ -90,6 +90,7 @@ fn test_replay() { bank_id: 0, entry_height: 0, last_entry_id: cur_hash, + next_blob_index: 0, }]; let bank = bank_forks.working_bank();