Skip to content

Commit

Permalink
distribute every 10 blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Feb 15, 2024
1 parent 1e7ee79 commit 145d46e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/distribution/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper)

// TODO this is Tendermint-dependent
// ref https://github.com/cosmos/cosmos-sdk/issues/3095
if ctx.BlockHeight() > 1 {
blockHeight := ctx.BlockHeight()
// only allocate rewards if the block height is greater than 1
// and only allocate rewards for every multiple of 10 blocks for performance reasons.
if blockHeight > 1 && blockHeight%10 == 0 {
k.AllocateTokens(ctx, previousTotalPower, req.LastCommitInfo.GetVotes())
}

Expand Down

0 comments on commit 145d46e

Please sign in to comment.