cosmos-sdk/x/staking/abci.go

28 lines
872 B
Go
Raw Normal View History

package staking
import (
"time"
abci "github.com/tendermint/tendermint/abci/types"
2020-06-18 11:12:44 -07:00
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
2020-06-18 11:12:44 -07:00
"github.com/cosmos/cosmos-sdk/x/staking/types"
)
// BeginBlocker will persist the current header and validator set as a historical entry
// and prune the oldest entry based on the HistoricalEntries parameter
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)
2020-06-18 11:12:44 -07:00
k.TrackHistoricalInfo(ctx)
}
// Called every block, update validator set
func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker)
2020-06-18 11:12:44 -07:00
return k.BlockValidatorUpdates(ctx)
}