From db2392a691d1ddfafd06b8209e0279a8448ce4be Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Tue, 7 Aug 2018 06:16:20 +0000 Subject: [PATCH] Use last_id from the entries stream instead of last_id from bank bank will only register ids when has_more is not set because those are the only ids it has advertised, so it will not register all ids, however the entry stream will contain unbroken last_id chain, so we need to track that to get the correct start hash. --- src/bank.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bank.rs b/src/bank.rs index b7e6ccc2e4fe78..e5aa579e536087 100644 --- a/src/bank.rs +++ b/src/bank.rs @@ -408,12 +408,14 @@ impl Bank { // Ledger verification needs to be parallelized, but we can't pull the whole // thing into memory. We therefore chunk it. let mut entry_count = *tail_idx as u64; + let mut id = self.last_id(); for block in &entries.into_iter().chunks(VERIFY_BLOCK_SIZE) { let block: Vec<_> = block.collect(); - if !block.verify(&self.last_id()) { + if !block.verify(&id) { warn!("Ledger proof of history failed at entry: {}", entry_count); return Err(BankError::LedgerVerificationFailed); } + id = block.last().unwrap().id; entry_count += self.process_entries_tail(block, tail, tail_idx)?; } Ok(entry_count)