Swap to individual offset
This commit is contained in:
parent
9cfc6de055
commit
6f3d81d5d6
|
@ -81,9 +81,10 @@ func (k Keeper) handleValidatorSignature(ctx sdk.Context, pubkey crypto.PubKey,
|
||||||
if !signed {
|
if !signed {
|
||||||
logger.Info(fmt.Sprintf("Absent validator %s at height %d", pubkey.Address(), height))
|
logger.Info(fmt.Sprintf("Absent validator %s at height %d", pubkey.Address(), height))
|
||||||
}
|
}
|
||||||
index := height % SignedBlocksWindow
|
|
||||||
address := pubkey.Address()
|
address := pubkey.Address()
|
||||||
signInfo, _ := k.getValidatorSigningInfo(ctx, address)
|
signInfo, _ := k.getValidatorSigningInfo(ctx, address)
|
||||||
|
signInfo.IndexOffset++
|
||||||
|
index := signInfo.IndexOffset % SignedBlocksWindow
|
||||||
previous := k.getValidatorSigningBitArray(ctx, address, index)
|
previous := k.getValidatorSigningBitArray(ctx, address, index)
|
||||||
if previous && !signed {
|
if previous && !signed {
|
||||||
k.setValidatorSigningBitArray(ctx, address, index, false)
|
k.setValidatorSigningBitArray(ctx, address, index, false)
|
||||||
|
@ -140,6 +141,7 @@ func (k Keeper) setValidatorSigningBitArray(ctx sdk.Context, address sdk.Address
|
||||||
|
|
||||||
type validatorSigningInfo struct {
|
type validatorSigningInfo struct {
|
||||||
StartHeight int64 `json:"start_height"`
|
StartHeight int64 `json:"start_height"`
|
||||||
|
IndexOffset int64 `json:"index_offset"`
|
||||||
SignedBlocksCounter int64 `json:"signed_blocks_counter"`
|
SignedBlocksCounter int64 `json:"signed_blocks_counter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue