Skip to content

Commit

Permalink
fix: mitigate panic caused by must acc address in abci (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond authored Aug 29, 2024
1 parent c059c40 commit b15c656
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions x/masterchef/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,13 @@ func (k Keeper) CollectGasFees(ctx sdk.Context, baseCurrency string) sdk.DecCoin

// Send coins to protocol revenue address
if protocolGasFeeCoins.IsAllPositive() {
protocolRevenueAddress := sdk.MustAccAddressFromBech32(params.ProtocolRevenueAddress)
err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, protocolRevenueAddress, protocolGasFeeCoins)
protocolRevenueAddress, err := sdk.AccAddressFromBech32(params.ProtocolRevenueAddress)
if err != nil {
// Handle the error by skipping the fee distribution
ctx.Logger().Error("Invalid protocol revenue address", "error", err)
return gasFeesForLpsDec
}
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.FeeCollectorName, protocolRevenueAddress, protocolGasFeeCoins)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit b15c656

Please sign in to comment.