Skip to content

Commit

Permalink
Merge pull request #6356 from filecoin-project/fix/migrate-config-failed
Browse files Browse the repository at this point in the history
fix: migrate config failed
  • Loading branch information
simlecode authored Jun 18, 2024
2 parents 868b0c7 + d6bf149 commit bf830c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pkg/migration/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var versionMap = []versionInfo{
{version: 10, upgrade: Version10Upgrade},
{version: 11, upgrade: Version11Upgrade},
{version: 12, upgrade: Version12Upgrade},
{version: 14, upgrade: Version14Upgrade},
{version: 13, upgrade: Version13Upgrade},
}

// TryToMigrate used to migrate data(db,config,file,etc) in local repo
Expand Down Expand Up @@ -438,8 +438,8 @@ func Version12Upgrade(repoPath string) (err error) {
return repo.WriteVersion(repoPath, 12)
}

// Version14Upgrade will modify mainnet bootstrap
func Version14Upgrade(repoPath string) (err error) {
// Version13Upgrade will modify mainnet bootstrap
func Version13Upgrade(repoPath string) (err error) {
var fsrRepo repo.Repo
if fsrRepo, err = repo.OpenFSRepo(repoPath, 12); err != nil {
return
Expand All @@ -461,5 +461,5 @@ func Version14Upgrade(repoPath string) (err error) {
return
}

return repo.WriteVersion(repoPath, 14)
return repo.WriteVersion(repoPath, 13)
}
4 changes: 2 additions & 2 deletions pkg/repo/fsrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

// Version is the version of repo schema that this code understands.
const LatestVersion uint = 14
const LatestVersion uint = 13

const (
// apiFile is the filename containing the filecoin node's api address.
Expand Down Expand Up @@ -203,7 +203,7 @@ func (r *FSRepo) loadFromDisk() error {
}

if localVersion > r.version {
return fmt.Errorf("binary needs update to handle repo version, got %d expected %d. Update binary to latest release", localVersion, LatestVersion)
return fmt.Errorf("binary needs update to handle repo version, got %d expected %d. Update binary to latest release", localVersion, r.version)
}

if err := r.loadConfig(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/repo/fsrepo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestFSRepoOpen(t *testing.T) {
assert.NoError(t, WriteVersion(repoPath, 99))

_, err := OpenFSRepo(repoPath, 1)
expected := fmt.Sprintf("binary needs update to handle repo version, got 99 expected %d. Update binary to latest release", LatestVersion)
expected := fmt.Sprintf("binary needs update to handle repo version, got 99 expected %d. Update binary to latest release", 1)
assert.EqualError(t, err, expected)
})

Expand Down

0 comments on commit bf830c7

Please sign in to comment.