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.
This commit is contained in:
parent
9c1b6288a4
commit
db2392a691
|
@ -408,12 +408,14 @@ impl Bank {
|
||||||
// Ledger verification needs to be parallelized, but we can't pull the whole
|
// Ledger verification needs to be parallelized, but we can't pull the whole
|
||||||
// thing into memory. We therefore chunk it.
|
// thing into memory. We therefore chunk it.
|
||||||
let mut entry_count = *tail_idx as u64;
|
let mut entry_count = *tail_idx as u64;
|
||||||
|
let mut id = self.last_id();
|
||||||
for block in &entries.into_iter().chunks(VERIFY_BLOCK_SIZE) {
|
for block in &entries.into_iter().chunks(VERIFY_BLOCK_SIZE) {
|
||||||
let block: Vec<_> = block.collect();
|
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);
|
warn!("Ledger proof of history failed at entry: {}", entry_count);
|
||||||
return Err(BankError::LedgerVerificationFailed);
|
return Err(BankError::LedgerVerificationFailed);
|
||||||
}
|
}
|
||||||
|
id = block.last().unwrap().id;
|
||||||
entry_count += self.process_entries_tail(block, tail, tail_idx)?;
|
entry_count += self.process_entries_tail(block, tail, tail_idx)?;
|
||||||
}
|
}
|
||||||
Ok(entry_count)
|
Ok(entry_count)
|
||||||
|
|
Loading…
Reference in New Issue