Skip to content

Commit

Permalink
modify genesis account balance check to check all coins
Browse files Browse the repository at this point in the history
  • Loading branch information
jiujiteiro committed Nov 15, 2022
1 parent f684800 commit bf0809d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions x/genutil/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func ValidateAccountInGenesis(
) error {
var stakingData stakingtypes.GenesisState
cdc.MustUnmarshalJSON(appGenesisState[stakingtypes.ModuleName], &stakingData)
bondDenom := stakingData.Params.BondDenom

var err error

Expand All @@ -56,10 +55,9 @@ func ValidateAccountInGenesis(
// ensure that account is in genesis
if accAddress.Equals(addr) {
// ensure account contains enough funds of default bond denom
if coins.AmountOf(bondDenom).GT(accCoins.AmountOf(bondDenom)) {
if coins.IsAnyGT(accCoins) {
err = fmt.Errorf(
"account %s has a balance in genesis, but it only has %v%s available to stake, not %v%s",
addr, accCoins.AmountOf(bondDenom), bondDenom, coins.AmountOf(bondDenom), bondDenom,
"account %s has a balance in genesis, but it does not have enough to stake", addr,
)

return true
Expand Down

0 comments on commit bf0809d

Please sign in to comment.