Update block height on validator bonding
This commit is contained in:
parent
5fd7297e25
commit
8c2c9dba8a
@ -713,7 +713,6 @@ func TestUnjail(t *testing.T) {
|
||||
tests.WaitForHeight(4, port)
|
||||
require.Equal(t, true, signingInfo.IndexOffset > 0)
|
||||
require.Equal(t, time.Unix(0, 0).UTC(), signingInfo.JailedUntil)
|
||||
require.Equal(t, true, signingInfo.SignedBlocksCounter > 0)
|
||||
}
|
||||
|
||||
func TestProposalsQuery(t *testing.T) {
|
||||
|
||||
@ -7,17 +7,19 @@ import (
|
||||
)
|
||||
|
||||
func (k Keeper) onValidatorBonded(ctx sdk.Context, address sdk.ConsAddress) {
|
||||
// Create a new signing info if necessary
|
||||
_, found := k.getValidatorSigningInfo(ctx, address)
|
||||
if !found {
|
||||
signingInfo := ValidatorSigningInfo{
|
||||
// Update the signing info start height or create a new signing info
|
||||
signingInfo, found := k.getValidatorSigningInfo(ctx, address)
|
||||
if found {
|
||||
signingInfo.StartHeight = ctx.BlockHeight()
|
||||
} else {
|
||||
signingInfo = ValidatorSigningInfo{
|
||||
StartHeight: ctx.BlockHeight(),
|
||||
IndexOffset: 0,
|
||||
JailedUntil: time.Unix(0, 0),
|
||||
MissedBlocksCounter: 0,
|
||||
}
|
||||
k.setValidatorSigningInfo(ctx, address, signingInfo)
|
||||
}
|
||||
k.setValidatorSigningInfo(ctx, address, signingInfo)
|
||||
|
||||
// Create a new slashing period when a validator is bonded
|
||||
slashingPeriod := ValidatorSlashingPeriod{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user