From 636bd0b3a7c97a00d58026d1419267e25790aa37 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Thu, 30 May 2024 19:49:44 +0100 Subject: [PATCH] rename authKeeper to accountKeeper; ensure accountKeeper is set on NewKeeper instantiation to avoid panic; fixes #526 --- custom/staking/keeper/keeper.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 0ddcaeed..25ec5512 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -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) { @@ -142,6 +142,7 @@ func NewKeeper( cdc: cdc, mintKeeper: mintkeeper.Keeper{}, distrKeeper: distkeeper.Keeper{}, + accountKeeper: ak, } return &keeper } @@ -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 {