Skip to content

Commit

Permalink
Fix test failing for non-existen dist module account
Browse files Browse the repository at this point in the history
  • Loading branch information
gjermundgaraba committed Oct 27, 2023
1 parent 98912ff commit 0935bc3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions chain/app/genesis-tools/genesis-single-validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,13 @@ func SetDistributionSingleValidator(cdc codec.Codec, genesisState *GenesisState,

// Get distribution module and set community pool == distribution module balance (rewards are now removed, so this is to get the balance to add up correctly)
distModuleAccount, found := GetModuleAccount(cdc, genesisState, distrtypes.ModuleName)
if !found {
log.Panicf("%s module account not found", distrtypes.ModuleName)
}
distrModuleBalance, found := GetBalanceOfAddress(genesisState, distModuleAccount.GetAddress().String(), params.BaseCoinDenom)
if !found {
log.Panicf("%s distrModuleBalance not found", distrtypes.ModuleName)
if found {
distrModuleBalance, found := GetBalanceOfAddress(genesisState, distModuleAccount.GetAddress().String(), params.BaseCoinDenom)
if !found {
log.Panicf("%s distrModuleBalance not found", distrtypes.ModuleName)
}
genesisState.DistrGenesis.FeePool.CommunityPool = sdk.NewDecCoins(sdk.NewDecCoin(params.BaseCoinDenom, distrModuleBalance.Amount))
}
genesisState.DistrGenesis.FeePool.CommunityPool = sdk.NewDecCoins(sdk.NewDecCoin(params.BaseCoinDenom, distrModuleBalance.Amount))

// Since we are removing all previous validators, we need to remove the slashing events to make event numbers add up correctly
genesisState.DistrGenesis.ValidatorSlashEvents = []distrtypes.ValidatorSlashEventRecord{}
Expand Down

0 comments on commit 0935bc3

Please sign in to comment.