mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
verify sigs on both votes; note about indices
This commit is contained in:
parent
35587658cd
commit
50850cf8a2
@ -44,10 +44,11 @@ func (dve *DuplicateVoteEvidence) Verify() error {
|
|||||||
return fmt.Errorf("DuplicateVoteEvidence Error: H/R/S does not match. Got %v and %v", dve.VoteA, dve.VoteB)
|
return fmt.Errorf("DuplicateVoteEvidence Error: H/R/S does not match. Got %v and %v", dve.VoteA, dve.VoteB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address and Index must be the same
|
// Address must be the same
|
||||||
if !bytes.Equal(dve.VoteA.ValidatorAddress, dve.VoteB.ValidatorAddress) {
|
if !bytes.Equal(dve.VoteA.ValidatorAddress, dve.VoteB.ValidatorAddress) {
|
||||||
return fmt.Errorf("DuplicateVoteEvidence Error: Validator addresses do not match. Got %X and %X", dve.VoteA.ValidatorAddress, dve.VoteB.ValidatorAddress)
|
return fmt.Errorf("DuplicateVoteEvidence Error: Validator addresses do not match. Got %X and %X", dve.VoteA.ValidatorAddress, dve.VoteB.ValidatorAddress)
|
||||||
}
|
}
|
||||||
|
// XXX: Should we enforce index is the same ?
|
||||||
if dve.VoteA.ValidatorIndex != dve.VoteB.ValidatorIndex {
|
if dve.VoteA.ValidatorIndex != dve.VoteB.ValidatorIndex {
|
||||||
return fmt.Errorf("DuplicateVoteEvidence Error: Validator indices do not match. Got %d and %d", dve.VoteA.ValidatorIndex, dve.VoteB.ValidatorIndex)
|
return fmt.Errorf("DuplicateVoteEvidence Error: Validator indices do not match. Got %d and %d", dve.VoteA.ValidatorIndex, dve.VoteB.ValidatorIndex)
|
||||||
}
|
}
|
||||||
@ -61,6 +62,9 @@ func (dve *DuplicateVoteEvidence) Verify() error {
|
|||||||
if !dve.PubKey.Verify(SignBytes(chainID, dve.VoteA), dve.VoteA.Signature) {
|
if !dve.PubKey.Verify(SignBytes(chainID, dve.VoteA), dve.VoteA.Signature) {
|
||||||
return ErrVoteInvalidSignature
|
return ErrVoteInvalidSignature
|
||||||
}
|
}
|
||||||
|
if !dve.PubKey.Verify(SignBytes(chainID, dve.VoteB), dve.VoteB.Signature) {
|
||||||
|
return ErrVoteInvalidSignature
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user