fix(server): fix fallback genesis path (backport #22564) (#22573)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2024-11-20 15:33:42 +00:00 committed by GitHub
parent d8d7eb0a31
commit 47874acfaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes
* (server) [#22564](https://github.com/cosmos/cosmos-sdk/pull/22564) Fix fallback genesis path in server
* (x/group) [#22425](https://github.com/cosmos/cosmos-sdk/pull/22425) Proper address rendering in error
* (sims) [#21906](https://github.com/cosmos/cosmos-sdk/pull/21906) Skip sims test when running dry on validators
* (cli) [#21919](https://github.com/cosmos/cosmos-sdk/pull/21919) Query address-by-acc-num by account_id instead of id.

View File

@ -513,7 +513,12 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) {
chainID := cast.ToString(appOpts.Get(flags.FlagChainID))
if chainID == "" {
// fallback to genesis chain-id
reader, err := os.Open(filepath.Join(homeDir, "config", "genesis.json"))
genesisPathCfg, _ := appOpts.Get("genesis_file").(string)
if genesisPathCfg == "" {
genesisPathCfg = filepath.Join("config", "genesis.json")
}
reader, err := os.Open(filepath.Join(homeDir, genesisPathCfg))
if err != nil {
panic(err)
}