Re-enable kernel history validation, re-add lost fix to validate the txhashset in a read only extension.

This commit is contained in:
Ignotus Peverell 2018-07-06 23:48:41 +01:00
parent dd90aaedbc
commit 0ab3cf29b8
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
2 changed files with 8 additions and 4 deletions

View file

@ -544,9 +544,15 @@ impl Chain {
let mut txhashset =
txhashset::TxHashSet::open(self.db_root.clone(), self.store.clone(), Some(&header))?;
// validate against a read-only extension first (some of the validation
// runs additional rewinds)
txhashset::extending_readonly(&mut txhashset, |extension| {
extension.rewind(&header, &header)?;
extension.validate(&header, false, status)
})?;
// all good, prepare a new batch and update all the required records
let mut batch = self.store.batch()?;
// Note: we are validating against a writeable extension.
txhashset::extending(&mut txhashset, &mut batch, |extension| {
// TODO do we need to rewind here? We have no blocks to rewind
// (and we need them for the pos to unremove)

View file

@ -911,8 +911,7 @@ impl<'a> Extension<'a> {
// Verify kernel roots for all past headers, need to be last as it rewinds
// a lot without resetting
// TODO broken in fast sync, fix
// self.verify_kernel_history(header)?;
self.verify_kernel_history(header)?;
Ok((output_sum, kernel_sum))
}
@ -1047,7 +1046,6 @@ impl<'a> Extension<'a> {
// header, rewind and check each root. This fixes a potential weakness in
// fast sync where a reorg past the horizon could allow a whole rewrite of
// the kernel set.
let header_head = header.clone();
let mut current = header.clone();
let empty_bitmap = Bitmap::create();
loop {