mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Validating an empty chain no longer panics (#850)
This commit is contained in:
parent
68b6bd25a4
commit
90a7f3d0f6
1 changed files with 6 additions and 0 deletions
|
@ -413,6 +413,12 @@ impl Chain {
|
||||||
/// Validate the current chain state.
|
/// Validate the current chain state.
|
||||||
pub fn validate(&self, skip_rproofs: bool) -> Result<(), Error> {
|
pub fn validate(&self, skip_rproofs: bool) -> Result<(), Error> {
|
||||||
let header = self.store.head_header()?;
|
let header = self.store.head_header()?;
|
||||||
|
|
||||||
|
// Lets just treat an "empty" node that just got started up as valid.
|
||||||
|
if header.height == 0 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut txhashset = self.txhashset.write().unwrap();
|
let mut txhashset = self.txhashset.write().unwrap();
|
||||||
|
|
||||||
// Now create an extension from the txhashset and validate
|
// Now create an extension from the txhashset and validate
|
||||||
|
|
Loading…
Reference in a new issue