Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
avery committed Nov 20, 2024
1 parent 401820d commit dcd6733
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions modules/htlc/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// BeginBlocker handles block beginning logic for HTLC
func BeginBlocker(c context.Context, k keeper.Keeper) {
func BeginBlocker(c context.Context, k keeper.Keeper) error {
ctx := sdk.UnwrapSDKContext(c)
ctx = ctx.WithLogger(ctx.Logger().With("handler", "beginBlock").With("module", "irismod/htlc"))

Expand All @@ -21,7 +21,9 @@ func BeginBlocker(c context.Context, k keeper.Keeper) {
ctx, currentBlockHeight,
func(id tmbytes.HexBytes, h types.HTLC) (stop bool) {
// refund HTLC
_ = k.RefundHTLC(ctx, h, id)
if err := k.RefundHTLC(ctx, h, id); err != nil {
return err
}
// delete from the expiration queue
k.DeleteHTLCFromExpiredQueue(ctx, currentBlockHeight, id)

Expand All @@ -39,4 +41,6 @@ func BeginBlocker(c context.Context, k keeper.Keeper) {
)

k.UpdateTimeBasedSupplyLimits(ctx)

return nil
}
3 changes: 1 addition & 2 deletions modules/htlc/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }

// BeginBlock performs a no-op.
func (am AppModule) BeginBlock(ctx context.Context) error {
BeginBlocker(ctx, am.keeper)
return nil
return BeginBlocker(ctx, am.keeper)
}

// EndBlock returns the end blocker for the HTLC module. It returns no validator updates.
Expand Down

0 comments on commit dcd6733

Please sign in to comment.