compile debugging
This commit is contained in:
parent
d9396ed732
commit
7002438d5f
@ -118,7 +118,7 @@ func (k Keeper) handleValidatorSignature(ctx sdk.Context, addr crypto.Address, p
|
||||
}
|
||||
minHeight := signInfo.StartHeight + k.SignedBlocksWindow(ctx)
|
||||
if height > minHeight && signInfo.SignedBlocksCounter < k.MinSignedPerWindow(ctx) {
|
||||
validator := k.validatorSet.ValidatorByPubKey(ctx, pubkey)
|
||||
validator := k.validatorSet.ValidatorByConsAddr(ctx, address)
|
||||
if validator != nil && !validator.GetJailed() {
|
||||
// Downtime confirmed: slash and jail the validator
|
||||
logger.Info(fmt.Sprintf("Validator %s past min height of %d and below signed blocks threshold of %d",
|
||||
|
||||
@ -88,11 +88,9 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k
|
||||
}
|
||||
|
||||
// call the hook if present
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnValidatorCreated(ctx, validator.OperatorAddr)
|
||||
accAddr := sdk.AccAddress(validator.OperatorAddr)
|
||||
k.hooks.OnDelegationCreated(ctx, accAddr, validator.OperatorAddr)
|
||||
}
|
||||
k.OnValidatorCreated(ctx, validator.OperatorAddr)
|
||||
accAddr := sdk.AccAddress(validator.OperatorAddr)
|
||||
k.OnDelegationCreated(ctx, accAddr, validator.OperatorAddr)
|
||||
|
||||
tags := sdk.NewTags(
|
||||
tags.Action, tags.ActionCreateValidator,
|
||||
@ -154,9 +152,7 @@ func handleMsgDelegate(ctx sdk.Context, msg types.MsgDelegate, k keeper.Keeper)
|
||||
}
|
||||
|
||||
// call the hook if present
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnDelegationCreated(ctx, msg.DelegatorAddr, validator.OperatorAddr)
|
||||
}
|
||||
k.OnDelegationCreated(ctx, msg.DelegatorAddr, validator.OperatorAddr)
|
||||
|
||||
tags := sdk.NewTags(
|
||||
tags.Action, tags.ActionDelegate,
|
||||
|
||||
54
x/stake/keeper/hooks.go
Normal file
54
x/stake/keeper/hooks.go
Normal file
@ -0,0 +1,54 @@
|
||||
//nolint
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// Expose the hooks if present
|
||||
func (k Keeper) OnValidatorCreated(ctx sdk.Context, address sdk.ValAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnValidatorCreated(ctx, address)
|
||||
}
|
||||
}
|
||||
func (k Keeper) OnValidatorCommissionChange(ctx sdk.Context, address sdk.ValAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnValidatorCommissionChange(ctx, address)
|
||||
}
|
||||
}
|
||||
|
||||
func (k Keeper) OnValidatorRemoved(ctx sdk.Context, address sdk.ValAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnValidatorRemoved(ctx, address)
|
||||
}
|
||||
}
|
||||
|
||||
func (k Keeper) OnValidatorBonded(ctx sdk.Context, address sdk.ConsAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnValidatorBonded(ctx, address)
|
||||
}
|
||||
}
|
||||
|
||||
func (k Keeper) OnValidatorBeginUnbonding(ctx sdk.Context, address sdk.ConsAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnValidatorBeginUnbonding(ctx, address)
|
||||
}
|
||||
}
|
||||
|
||||
func (k Keeper) OnDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnDelegationCreated(ctx, delAddr, valAddr)
|
||||
}
|
||||
}
|
||||
|
||||
func (k Keeper) OnDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnDelegationSharesModified(ctx, delAddr, valAddr)
|
||||
}
|
||||
}
|
||||
|
||||
func (k Keeper) OnDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) {
|
||||
if k.hooks != nil {
|
||||
k.hooks.OnDelegationRemoved(ctx, delAddr, valAddr)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user