Skip to content

panic when running proposer election on empty validator set #3224

@ancazamfir

Description

@ancazamfir

func TestEmptySet(t *testing.T) {
valList := []*Validator{}
vals := NewValidatorSet(valList)
vals.IncrementProposerPriority(1)
}

and run:

=== RUN TestEmptySet
--- FAIL: TestEmptySet (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x15b2b27]

goroutine 9 [running]:
testing.tRunner.func1(0xc000167200)
/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:792 +0x387
panic(0x168e260, 0x1de4340)
/usr/local/Cellar/go/1.11.2/libexec/src/runtime/panic.go:513 +0x1b9
github.com/tendermint/tendermint/types.(*ValidatorSet).incrementProposerPriority(0xc0004c72f0, 0x0)
/Users/ancaz/go/src/github.com/tendermint/tendermint/types/validator_set.go:146 +0xe7
github.com/tendermint/tendermint/types.(*ValidatorSet).IncrementProposerPriority(0xc0004c72f0, 0x1)
/Users/ancaz/go/src/github.com/tendermint/tendermint/types/validator_set.go:94 +0x71
github.com/tendermint/tendermint/types.TestEmptySet(0xc000167200)
/Users/ancaz/go/src/github.com/tendermint/tendermint/types/validator_set_test.go:606 +0x4a
testing.tRunner(0xc000167200, 0x18986d0)
/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:878 +0x353

Process finished with exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions