If only the last signer is left, voting for it is invalid

This commit is contained in:
wcc 2018-09-17 10:04:22 +08:00
parent f6ed68e13e
commit c15e5b0c73

View file

@ -139,6 +139,11 @@ func (s *Snapshot) copy() *Snapshot {
// given snapshot context (e.g. don't try to add an already authorized signer). // given snapshot context (e.g. don't try to add an already authorized signer).
func (s *Snapshot) validVote(address common.Address, authorize bool) bool { func (s *Snapshot) validVote(address common.Address, authorize bool) bool {
_, signer := s.Signers[address] _, signer := s.Signers[address]
if len(s.Signers) == 1 && signer && authorize == false {
return false
}
return (signer && !authorize) || (!signer && authorize) return (signer && !authorize) || (!signer && authorize)
} }