mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
force rollback on txhashset extension when validating (#824)
This commit is contained in:
parent
4fa9ccc4f7
commit
1d7a7457fc
1 changed files with 10 additions and 1 deletions
|
@ -415,7 +415,16 @@ impl Chain {
|
||||||
pub fn validate(&self) -> Result<(), Error> {
|
pub fn validate(&self) -> Result<(), Error> {
|
||||||
let header = self.store.head_header()?;
|
let header = self.store.head_header()?;
|
||||||
let mut txhashset = self.txhashset.write().unwrap();
|
let mut txhashset = self.txhashset.write().unwrap();
|
||||||
txhashset::extending(&mut txhashset, |extension| extension.validate(&header))
|
|
||||||
|
// Now create an extension from the txhashset and validate
|
||||||
|
// against the latest block header.
|
||||||
|
// We will rewind the extension internally to the pos for
|
||||||
|
// the block header to ensure the view is consistent.
|
||||||
|
// Force rollback first as this is a "read-only" extension.
|
||||||
|
txhashset::extending(&mut txhashset, |extension| {
|
||||||
|
extension.force_rollback();
|
||||||
|
extension.validate(&header)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the input has matured sufficiently for the given block height.
|
/// Check if the input has matured sufficiently for the given block height.
|
||||||
|
|
Loading…
Reference in a new issue