mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Re-enable kernel history validation, re-add lost fix to validate the txhashset in a read only extension.
This commit is contained in:
parent
dd90aaedbc
commit
0ab3cf29b8
2 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue