From 90a7f3d0f62f736cb8f6e0a439b7bfa7c921509a Mon Sep 17 00:00:00 2001 From: Antioch Peverell <30642645+antiochp@users.noreply.github.com> Date: Thu, 22 Mar 2018 21:48:05 -0400 Subject: [PATCH] Validating an empty chain no longer panics (#850) --- chain/src/chain.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 4335878dc..904b992f8 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -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