Validating an empty chain no longer panics (#850)

This commit is contained in:
Antioch Peverell 2018-03-22 21:48:05 -04:00 committed by Ignotus Peverell
parent 68b6bd25a4
commit 90a7f3d0f6

View file

@ -413,6 +413,12 @@ impl Chain {
/// Validate the current chain state.
pub fn validate(&self, skip_rproofs: bool) -> Result<(), Error> {
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();
// Now create an extension from the txhashset and validate