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

Method ValidateBasic

types/block.go:868–891  ·  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

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

Callers

nothing calls this directly

Calls 2

ValidateBasicMethod · 0.65
IsZeroMethod · 0.45

Tested by

no test coverage detected