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

Method ValidateBasic

types/light.go:21–44  ·  view source on GitHub ↗

ValidateBasic checks that the data is correct and consistent This does no verification of the signatures

(chainID string)

Source from the content-addressed store, hash-verified

19//
20// This does no verification of the signatures
21func (lb LightBlock) ValidateBasic(chainID string) error {
22 if lb.SignedHeader == nil {
23 return errors.New("missing signed header")
24 }
25 if lb.ValidatorSet == nil {
26 return errors.New("missing validator set")
27 }
28
29 if err := lb.SignedHeader.ValidateBasic(chainID); err != nil {
30 return fmt.Errorf("invalid signed header: %w", err)
31 }
32 if err := lb.ValidatorSet.ValidateBasic(); err != nil {
33 return fmt.Errorf("invalid validator set: %w", err)
34 }
35
36 // make sure the validator set is consistent with the header
37 if valSetHash := lb.ValidatorSet.Hash(); !bytes.Equal(lb.SignedHeader.ValidatorsHash, valSetHash) {
38 return fmt.Errorf("expected validator hash of header to match validator set hash (%X != %X)",
39 lb.SignedHeader.ValidatorsHash, valSetHash,
40 )
41 }
42
43 return nil
44}
45
46// String returns a string representation of the LightBlock
47func (lb LightBlock) String() string {

Callers 2

LightBlockMethod · 0.95

Calls 3

ValidateBasicMethod · 0.65
HashMethod · 0.65
EqualMethod · 0.65

Tested by 1