Skip to content

Commit

Permalink
less stake endblock processing
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelrozanski committed Jul 20, 2018
1 parent accce5c commit 9e5a78f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/gaia/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) ab
// application updates every end block
// nolint: unparam
func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)

validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)
tags, _ := gov.EndBlocker(ctx, app.govKeeper)

return abci.ResponseEndBlock{
Expand Down
1 change: 1 addition & 0 deletions x/slashing/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// slashing begin block functionality
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, sk Keeper) (tags sdk.Tags) {

// Tag the height
heightBytes := make([]byte, 8)
binary.LittleEndian.PutUint64(heightBytes, uint64(req.Header.Height))
Expand Down
10 changes: 4 additions & 6 deletions x/stake/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,17 @@ func NewHandler(k keeper.Keeper) sdk.Handler {

// Called every block, process inflation, update validator set
func EndBlocker(ctx sdk.Context, k keeper.Keeper) (ValidatorUpdates []abci.Validator) {
pool := k.GetPool(ctx)
params := k.GetParams(ctx)

// Process types.Validator Provisions
// Process provision inflation
blockTime := ctx.BlockHeader().Time
if blockTime-pool.InflationLastTime >= 3600 {
params := k.GetParams(ctx)
pool := k.GetPool(ctx)
pool.InflationLastTime = blockTime
pool = pool.ProcessProvisions(params)
k.SetPool(ctx, pool)
}

// save the params
k.SetPool(ctx, pool)

// reset the intra-transaction counter
k.SetIntraTxCounter(ctx, 0)

Expand Down

0 comments on commit 9e5a78f

Please sign in to comment.