metrics: add a counter for validator to check work status of voting (#1583)

This commit is contained in:
NathanBSC 2023-05-06 20:47:31 +08:00 committed by GitHub
parent 880535c730
commit 5f690d32eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,6 +78,7 @@ var (
maxSystemBalance = new(big.Int).Mul(big.NewInt(100), big.NewInt(params.Ether))
verifyVoteAttestationErrorCounter = metrics.NewRegisteredCounter("parlia/verifyVoteAttestation/error", nil)
updateAttestationErrorCounter = metrics.NewRegisteredCounter("parlia/updateAttestation/error", nil)
validVotesfromSelfCounter = metrics.NewRegisteredCounter("parlia/VerifyVote/self", nil)
systemContracts = map[common.Address]bool{
common.HexToAddress(systemcontracts.ValidatorContract): true,
@ -1216,8 +1217,11 @@ func (p *Parlia) VerifyVote(chain consensus.ChainHeaderReader, vote *types.VoteE
validators := snap.Validators
voteAddress := vote.VoteAddress
for _, validator := range validators {
for addr, validator := range validators {
if validator.VoteAddress == voteAddress {
if addr == p.val {
validVotesfromSelfCounter.Inc(1)
}
return nil
}
}