diff --git a/core/blockchain.go b/core/blockchain.go index 5ba6d469d..a32a70db3 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -385,16 +385,13 @@ func (bc *BlockChain) loadLastState() error { // Restore the last known head block head := rawdb.ReadHeadBlockHash(bc.db) if head == (common.Hash{}) { - // Corrupt or empty database, init from scratch - log.Warn("Empty database, resetting chain") - return bc.Reset() + return fmt.Errorf("empty or corrupt database") } // Make sure the entire head block is available currentBlock := bc.GetBlockByHash(head) if currentBlock == nil { // Corrupt or empty database, init from scratch - log.Warn("Head block missing, resetting chain", "hash", head) - return bc.Reset() + return fmt.Errorf("head block missing, hash %x", head) } // Make sure the state associated with the block is available // Everything seems to be fine, set as the head block @@ -421,15 +418,12 @@ func (bc *BlockChain) loadLastState() error { } } // Issue a status log for the user - currentFastBlock := bc.CurrentFastBlock() headerTd := bc.GetTd(currentHeader.Hash(), currentHeader.Number.Uint64()) blockTd := bc.GetTd(currentBlock.Hash(), currentBlock.NumberU64()) - fastTd := bc.GetTd(currentFastBlock.Hash(), currentFastBlock.NumberU64()) - log.Info("Loaded most recent local header", "number", currentHeader.Number, "hash", currentHeader.Hash(), "td", headerTd, "age", common.PrettyAge(time.Unix(int64(currentHeader.Time), 0))) - log.Info("Loaded most recent local full block", "number", currentBlock.Number(), "hash", currentBlock.Hash(), "td", blockTd, "age", common.PrettyAge(time.Unix(int64(currentBlock.Time()), 0))) - log.Info("Loaded most recent local fast block", "number", currentFastBlock.Number(), "hash", currentFastBlock.Hash(), "td", fastTd, "age", common.PrettyAge(time.Unix(int64(currentFastBlock.Time()), 0))) + log.Info("Most recent local header", "number", currentHeader.Number, "hash", currentHeader.Hash(), "td", headerTd, "age", common.PrettyAge(time.Unix(int64(currentHeader.Time), 0))) + log.Info("Most recent local block", "number", currentBlock.Number(), "hash", currentBlock.Hash(), "td", blockTd, "age", common.PrettyAge(time.Unix(int64(currentBlock.Time()), 0))) return nil }