mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-30 19:06:21 +00:00
fix consensus
This commit is contained in:
@@ -245,6 +245,9 @@ func (m *VoteSetMaj23Message) ValidateBasic() error {
|
||||
if !types.IsVoteTypeValid(m.Type) {
|
||||
return errors.New("invalid Type")
|
||||
}
|
||||
if m.Round < 0 {
|
||||
return errors.New("negative Round")
|
||||
}
|
||||
if err := m.BlockID.ValidateBasic(); err != nil {
|
||||
return fmt.Errorf("wrong BlockID: %v", err)
|
||||
}
|
||||
|
||||
@@ -68,12 +68,16 @@ func filterMinMax(base, height, min, max, limit uint64) (uint64, uint64, error)
|
||||
|
||||
// limit min to within `limit` of max
|
||||
// so the total number of blocks returned will be `limit`
|
||||
min = tmmath.MaxUint64(min, max-limit+1)
|
||||
mm := tmmath.MaxInt64(int64(min), int64(max-limit+1))
|
||||
|
||||
if min > max {
|
||||
// min can be zero and we will allow it
|
||||
if mm > int64(max) {
|
||||
return min, max, fmt.Errorf("%w: min height %d can't be greater than max height %d",
|
||||
ctypes.ErrInvalidRequest, min, max)
|
||||
}
|
||||
if mm < 0 {
|
||||
min = 0
|
||||
}
|
||||
return min, max, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestBlockchainInfo(t *testing.T) {
|
||||
min, max uint64
|
||||
base, height uint64
|
||||
limit uint64
|
||||
resultLength int64
|
||||
resultLength uint64
|
||||
wantErr bool
|
||||
}{
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestBlockchainInfo(t *testing.T) {
|
||||
{1, 5, 0, 1, 10, 1, false},
|
||||
{1, 5, 0, 10, 10, 5, false},
|
||||
{1, 15, 0, 10, 10, 10, false},
|
||||
{1, 15, 0, 15, 10, 10, false},
|
||||
{1, 15, 0, 15, 10, 10, false}, //
|
||||
{1, 15, 0, 15, 20, 15, false},
|
||||
{1, 20, 0, 15, 20, 15, false},
|
||||
{1, 20, 0, 20, 20, 20, false},
|
||||
|
||||
Reference in New Issue
Block a user