MCPcopy Create free account
hub / github.com/tendermint/tendermint / ValidateBasic

Method ValidateBasic

types/block.go:877–900  ·  view source on GitHub ↗

ValidateBasic performs basic validation that doesn't involve state data. Does not actually check the cryptographic signatures.

()

Source from the content-addressed store, hash-verified

875// ValidateBasic performs basic validation that doesn't involve state data.
876// Does not actually check the cryptographic signatures.
877func (commit *Commit) ValidateBasic() error {
878 if commit.Height < 0 {
879 return errors.New("negative Height")
880 }
881 if commit.Round < 0 {
882 return errors.New("negative Round")
883 }
884
885 if commit.Height >= 1 {
886 if commit.BlockID.IsZero() {
887 return errors.New("commit cannot be for nil block")
888 }
889
890 if len(commit.Signatures) == 0 {
891 return errors.New("no signatures in commit")
892 }
893 for i, commitSig := range commit.Signatures {
894 if err := commitSig.ValidateBasic(); err != nil {
895 return fmt.Errorf("wrong CommitSig #%d: %v", i, err)
896 }
897 }
898 }
899 return nil
900}
901
902// Hash returns the hash of the commit
903func (commit *Commit) Hash() tmbytes.HexBytes {

Callers

nothing calls this directly

Calls 2

ValidateBasicMethod · 0.65
IsZeroMethod · 0.45

Tested by

no test coverage detected