From 6f661481a9ff4184c9ebc684104b77add61ecfee Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 25 Feb 2021 17:35:02 +0100 Subject: [PATCH] linting fixes --- consensus/msgs.go | 24 ------------------------ rpc/core/blocks.go | 4 ---- 2 files changed, 28 deletions(-) diff --git a/consensus/msgs.go b/consensus/msgs.go index ea9399ee4..cef9886e6 100644 --- a/consensus/msgs.go +++ b/consensus/msgs.go @@ -45,9 +45,6 @@ type NewRoundStepMessage struct { // ValidateBasic performs basic validation. func (m *NewRoundStepMessage) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } if m.Round < 0 { return errors.New("negative Round") } @@ -103,9 +100,6 @@ type NewValidBlockMessage struct { // ValidateBasic performs basic validation. func (m *NewValidBlockMessage) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } if m.Round < 0 { return errors.New("negative Round") } @@ -156,9 +150,6 @@ type ProposalPOLMessage struct { // ValidateBasic performs basic validation. func (m *ProposalPOLMessage) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } if m.ProposalPOLRound < 0 { return errors.New("negative ProposalPOLRound") } @@ -185,9 +176,6 @@ type BlockPartMessage struct { // ValidateBasic performs basic validation. func (m *BlockPartMessage) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } if m.Round < 0 { return errors.New("negative Round") } @@ -227,9 +215,6 @@ type HasVoteMessage struct { // ValidateBasic performs basic validation. func (m *HasVoteMessage) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } if m.Round < 0 { return errors.New("negative Round") } @@ -257,12 +242,6 @@ type VoteSetMaj23Message struct { // ValidateBasic performs basic validation. func (m *VoteSetMaj23Message) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } - if m.Round < 0 { - return errors.New("negative Round") - } if !types.IsVoteTypeValid(m.Type) { return errors.New("invalid Type") } @@ -290,9 +269,6 @@ type VoteSetBitsMessage struct { // ValidateBasic performs basic validation. func (m *VoteSetBitsMessage) ValidateBasic() error { - if m.Height < 0 { - return errors.New("negative Height") - } if !types.IsVoteTypeValid(m.Type) { return errors.New("invalid Type") } diff --git a/rpc/core/blocks.go b/rpc/core/blocks.go index 5b7d1c91a..468bf7d6a 100644 --- a/rpc/core/blocks.go +++ b/rpc/core/blocks.go @@ -51,10 +51,6 @@ func BlockchainInfo(ctx *rpctypes.Context, minHeight, maxHeight uint64) (*ctypes // if 0, use blockstore base for min, latest block height for max // enforce limit. func filterMinMax(base, height, min, max, limit uint64) (uint64, uint64, error) { - // filter negatives - if min < 0 || max < 0 { - return min, max, ctypes.ErrZeroOrNegativeHeight - } // adjust for default values if min == 0 {