Swap to individual offset

This commit is contained in:
Christopher Goes 2018-05-26 02:05:46 +02:00
parent 9cfc6de055
commit 6f3d81d5d6
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
1 changed files with 3 additions and 1 deletions

View File

@ -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"`
} }