ValidateBasic performs basic validation.
()
| 1793 | |
| 1794 | // ValidateBasic performs basic validation. |
| 1795 | func (m *VoteSetBitsMessage) ValidateBasic() error { |
| 1796 | if m.Height < 0 { |
| 1797 | return errors.New("negative Height") |
| 1798 | } |
| 1799 | if !types.IsVoteTypeValid(m.Type) { |
| 1800 | return errors.New("invalid Type") |
| 1801 | } |
| 1802 | if err := m.BlockID.ValidateBasic(); err != nil { |
| 1803 | return fmt.Errorf("wrong BlockID: %v", err) |
| 1804 | } |
| 1805 | // NOTE: Votes.Size() can be zero if the node does not have any |
| 1806 | if m.Votes.Size() > types.MaxVotesCount { |
| 1807 | return fmt.Errorf("votes bit array is too big: %d, max: %d", m.Votes.Size(), types.MaxVotesCount) |
| 1808 | } |
| 1809 | return nil |
| 1810 | } |
| 1811 | |
| 1812 | // String returns a string representation. |
| 1813 | func (m *VoteSetBitsMessage) String() string { |