2018-09-13 23:35:02 -07:00
|
|
|
package distribution
|
|
|
|
|
|
|
|
import (
|
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
2018-09-19 19:54:46 -07:00
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
2018-09-13 23:35:02 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
// set the proposer for determining distribution during endblock
|
|
|
|
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
|
2018-09-19 20:01:55 -07:00
|
|
|
consAddr := sdk.ConsAddress(req.Header.Proposer.Address)
|
|
|
|
k.SetProposerConsAddr(ctx, consAddr)
|
2018-09-13 23:35:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// allocate fees
|
|
|
|
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
|
2018-09-28 01:02:07 -07:00
|
|
|
if ctx.BlockHeight() < 2 {
|
|
|
|
return
|
|
|
|
}
|
2018-09-13 23:35:02 -07:00
|
|
|
k.AllocateFees(ctx)
|
|
|
|
}
|