Skip to content

Commit

Permalink
refactor: change the meaning of VoteSetCounter
Browse files Browse the repository at this point in the history
Now `VoteSetCounter` in HandleValidatorSignature indicates the real
counted number, not a index-like number.
  • Loading branch information
0Tech committed Oct 6, 2021
1 parent b914b62 commit 45d50ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/slashing/keeper/infractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre

// this is a relative index, so it counts blocks the validator *should* have signed
// will use the 0-value default signing info if not present, except for the beginning
voterSetCounter := signInfo.VoterSetCounter
signInfo.VoterSetCounter++
index := voterSetCounter % k.SignedBlocksWindow(ctx)
voterSetCounter := signInfo.VoterSetCounter
index := (voterSetCounter - 1) % k.SignedBlocksWindow(ctx)

// Update signed block bit array & counter
// This counter just tracks the sum of the bit array
Expand Down Expand Up @@ -70,7 +70,7 @@ func (k Keeper) HandleValidatorSignature(ctx sdk.Context, addr cryptotypes.Addre
)
}

minVoterSetCount := k.SignedBlocksWindow(ctx) - 1
minVoterSetCount := k.SignedBlocksWindow(ctx)
maxMissed := k.SignedBlocksWindow(ctx) - minSignedPerWindow

// if we have joined enough times to voter set and the validator has missed too many blocks, punish them
Expand Down

0 comments on commit 45d50ad

Please sign in to comment.