Skip to content

Commit

Permalink
Fix upgrade path (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi authored and alexlyp committed Aug 25, 2016
1 parent 717040c commit 99b7aad
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ var oldTicketDBName = "ticketdb_old.gob"
// from before ffldb was introduced and renames it in preparation for resyncing
// the blockchain.
func checkForAndMoveOldTicketDb() error {
ffldbPath := filepath.Join(cfg.DcrdHomeDir, defaultDataDirname,
activeNetParams.Name, blockDbNamePrefix+"_"+defaultDbType)
ffldbPath := filepath.Join(cfg.DataDir,
blockDbNamePrefix+"_"+defaultDbType)

if _, err := os.Stat(ffldbPath); os.IsNotExist(err) {
// Rename the old ticket database.
ticketDBPath := filepath.Join(cfg.DcrdHomeDir, defaultDataDirname,
activeNetParams.Name, ticketDBName)
ticketDBPath := filepath.Join(cfg.DataDir, ticketDBName)
if _, err := os.Stat(ticketDBPath); !os.IsNotExist(err) && err != nil {
return err
}
Expand All @@ -32,8 +31,7 @@ func checkForAndMoveOldTicketDb() error {
oldTicketDBName + ". It can be safely removed if you " +
"no longer wish to roll back to an old version of the " +
"software.")
oldTicketDBPath := filepath.Join(cfg.DcrdHomeDir, defaultDataDirname,
activeNetParams.Name, oldTicketDBName)
oldTicketDBPath := filepath.Join(cfg.DataDir, oldTicketDBName)
err = os.Rename(ticketDBPath, oldTicketDBPath)
if err != nil {
return err
Expand Down

0 comments on commit 99b7aad

Please sign in to comment.