From 7ddf9e4cff05701688fd7b8b382f8da37484a382 Mon Sep 17 00:00:00 2001 From: Harish Marri Date: Thu, 7 Nov 2024 16:15:00 +0530 Subject: [PATCH] fix itc endblocker --- x/itc/abci.go | 6 +++--- x/itc/module.go | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/x/itc/abci.go b/x/itc/abci.go index 347c55a..6103f27 100644 --- a/x/itc/abci.go +++ b/x/itc/abci.go @@ -6,12 +6,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func EndBlock(ctx sdk.Context, k keeper.Keeper) []abcitypes.ValidatorUpdate { +func EndBlock(ctx sdk.Context, k keeper.Keeper) ([]abcitypes.ValidatorUpdate, error) { log := k.Logger(ctx) err := k.FinalizeAndEndCampaigns(ctx) if err != nil { - panic(err) + return nil, err } log.Info("Updated and processed campaigns .. ") - return []abcitypes.ValidatorUpdate{} + return []abcitypes.ValidatorUpdate{}, nil } diff --git a/x/itc/module.go b/x/itc/module.go index 0be0f9c..a88b58a 100644 --- a/x/itc/module.go +++ b/x/itc/module.go @@ -164,3 +164,13 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } + +// BeginBlock executes all ABCI BeginBlock logic respective to the marketplace module. +func (am AppModule) BeginBlock(_ sdk.Context) {} + +// EndBlock executes all ABCI EndBlock logic respective to the marketplace module. It +// returns no validator updates. +func (am AppModule) EndBlock(goCtx context.Context) ([]abci.ValidatorUpdate, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + return EndBlock(ctx, am.keeper) +}