Skip to content

Commit

Permalink
resolve with cb
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Aug 7, 2023
1 parent eddff3c commit 5d510c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x/genutil/client/cli/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $ %s migrate v0.36 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2
`, version.AppName),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
return MigrateHandler(cmd, args, migrationMap)
return MigrateHandler(cmd, args, GetMigrationCallback)
},
}

Expand All @@ -74,7 +74,8 @@ $ %s migrate v0.36 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2

// MigrateHandler handles the migration command with a migration map as input,
// returning an error upon failure.
func MigrateHandler(cmd *cobra.Command, args []string, migrations types.MigrationMap) error {
// func MigrateHandler(cmd *cobra.Command, args []string, migrations types.MigrationMap) error {
func MigrateHandler(cmd *cobra.Command, args []string, cb func(version string) types.MigrationCallback) error {
clientCtx := client.GetClientContextFromCmd(cmd)

var err error
Expand All @@ -100,7 +101,7 @@ func MigrateHandler(cmd *cobra.Command, args []string, migrations types.Migratio
return errors.Wrap(err, "failed to JSON unmarshal initial genesis state")
}

migrationFunc := migrations[target]
migrationFunc := cb(target)
if migrationFunc == nil {
return fmt.Errorf("unknown migration function for version: %s", target)
}
Expand Down

0 comments on commit 5d510c3

Please sign in to comment.