Skip to content

Commit

Permalink
fix: err check (cosmos#1880)
Browse files Browse the repository at this point in the history
* fix: change log.Fatal to panic, defer iter.Close()

* update export.go

* fix: lint
  • Loading branch information
yaruwangway authored Nov 4, 2022
1 parent fd11e22 commit 92136cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gaia

import (
"encoding/json"
"log"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -59,7 +58,7 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
for _, addr := range jailAllowedAddrs {
_, err := sdk.ValAddressFromBech32(addr)
if err != nil {
log.Fatal(err)
panic(err)
}
allowedAddrsMap[addr] = true
}
Expand Down Expand Up @@ -110,7 +109,7 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [

err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
if err != nil {
log.Fatal(err)
panic(err)
}
return false
})
Expand Down Expand Up @@ -163,6 +162,7 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
// update bond intra-tx counters.
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)

counter := int16(0)

for ; iter.Valid(); iter.Next() {
Expand All @@ -185,7 +185,7 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [

_, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx)
if err != nil {
log.Fatal(err)
panic(err)
}

/* Handle slashing state. */
Expand Down

0 comments on commit 92136cc

Please sign in to comment.