Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic on use of nil authKeeper/accountKeeper #527

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions custom/staking/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Keeper struct {
authority string
mintKeeper mintkeeper.Keeper
distrKeeper distkeeper.Keeper
authKeeper minttypes.AccountKeeper
accountKeeper types.AccountKeeper
}

func (k Keeper) BlockValidatorUpdates(ctx context.Context) ([]abcicometbft.ValidatorUpdate, error) {
Expand Down Expand Up @@ -142,6 +142,7 @@ func NewKeeper(
cdc: cdc,
mintKeeper: mintkeeper.Keeper{},
distrKeeper: distkeeper.Keeper{},
accountKeeper: ak,
}
return &keeper
}
Expand Down Expand Up @@ -172,7 +173,7 @@ func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.Cons
if err != nil {
k.Logger(ctx).Error("Failed to mint slashed coins: ", amountBurned)
} else {
err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(minttypes.ModuleName))
err = k.distrKeeper.FundCommunityPool(ctx, coins, k.accountKeeper.GetModuleAddress(minttypes.ModuleName))
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Failed to fund community pool. Tokens minted to the staking module account: %d. ", amountBurned))
} else {
Expand Down
Loading