Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migrate config failed #6356

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading