diff --git a/proto/tendermint/blocksync/message.go b/proto/tendermint/blocksync/message.go index 1840c4e61..b099b225d 100644 --- a/proto/tendermint/blocksync/message.go +++ b/proto/tendermint/blocksync/message.go @@ -1,7 +1,6 @@ package blocksync import ( - "errors" "fmt" "github.com/gogo/protobuf/proto" @@ -60,48 +59,3 @@ func (m *Message) Unwrap() (proto.Message, error) { return nil, fmt.Errorf("unknown message: %T", msg) } } - -// Validate validates the message returning an error upon failure. -func (m *Message) Validate() error { - if m == nil { - return errors.New("message cannot be nil") - } - - switch msg := m.Sum.(type) { - case *Message_BlockRequest: - if m.GetBlockRequest().Height < 0 { - return errors.New("negative Height") - } - - case *Message_BlockResponse: - // validate basic is called later when converting from proto - return nil - - case *Message_NoBlockResponse: - if m.GetNoBlockResponse().Height < 0 { - return errors.New("negative Height") - } - - case *Message_StatusResponse: - if m.GetStatusResponse().Base < 0 { - return errors.New("negative Base") - } - if m.GetStatusResponse().Height < 0 { - return errors.New("negative Height") - } - if m.GetStatusResponse().Base > m.GetStatusResponse().Height { - return fmt.Errorf( - "base %v cannot be greater than height %v", - m.GetStatusResponse().Base, m.GetStatusResponse().Height, - ) - } - - case *Message_StatusRequest: - return nil - - default: - return fmt.Errorf("unknown message type: %T", msg) - } - - return nil -}