MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / ValidateBasic

Method ValidateBasic

consensus/reactor.go:1795–1810  ·  view source on GitHub ↗

ValidateBasic performs basic validation.

()

Source from the content-addressed store, hash-verified

1793
1794// ValidateBasic performs basic validation.
1795func (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.
1813func (m *VoteSetBitsMessage) String() string {

Callers 1

Calls 3

IsVoteTypeValidFunction · 0.92
ValidateBasicMethod · 0.65
SizeMethod · 0.65

Tested by 1