From 27a7bb1c86093b07fdeefa7b964925713f60efe6 Mon Sep 17 00:00:00 2001 From: C Jepson Date: Mon, 29 Aug 2016 14:40:30 -0400 Subject: [PATCH] Don't fail if no blockchain folder exists (#326) Startup would fail if there was no preexisting folder for the selected blockchain. --- upgrade.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/upgrade.go b/upgrade.go index 288d7af9..32ace713 100644 --- a/upgrade.go +++ b/upgrade.go @@ -20,6 +20,13 @@ func checkForAndMoveOldTicketDb() error { ffldbPath := filepath.Join(cfg.DataDir, blockDbNamePrefix+"_"+defaultDbType) + // No data path exists, break because this is a fresh start and + // the database must be constructed. + if _, err := os.Stat(cfg.DataDir); os.IsNotExist(err) { + return nil + } + + // An old version of the chain exists, update it. if _, err := os.Stat(ffldbPath); os.IsNotExist(err) { // Rename the old ticket database. ticketDBPath := filepath.Join(cfg.DataDir, ticketDBName)