diff --git a/types/block.go b/types/block.go index a029bffae..6ee3540e9 100644 --- a/types/block.go +++ b/types/block.go @@ -89,6 +89,17 @@ func (b *Block) ValidateBasic() error { // NOTE: b.Evidence.Evidence may be nil, but we're just looping. for i, ev := range b.Evidence.Evidence { + switch ev.(type) { + case *ConflictingHeadersEvidence, ConflictingHeadersEvidence: + // ConflictingHeadersEvidence must be broken up in pieces and never + // committed as a single piece. + return fmt.Errorf("found ConflictingHeadersEvidence (#%d)", i) + case *PotentialAmnesiaEvidence, PotentialAmnesiaEvidence: + // PotentialAmnesiaEvidence does not contribute to anything on its own, so + // reject it as well. + return fmt.Errorf("found PotentialAmnesiaEvidence (#%d)", i) + } + if err := ev.ValidateBasic(); err != nil { return fmt.Errorf("invalid evidence (#%d): %v", i, err) } diff --git a/types/block_test.go b/types/block_test.go index 6f3a98244..138c99caa 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -86,6 +86,12 @@ func TestBlockValidateBasic(t *testing.T) { {"Tampered EvidenceHash", func(blk *Block) { blk.EvidenceHash = []byte("something else") }, true}, + {"ConflictingHeadersEvidence", func(blk *Block) { + blk.Evidence = EvidenceData{Evidence: []Evidence{&ConflictingHeadersEvidence{}}} + }, true}, + {"PotentialAmnesiaEvidence", func(blk *Block) { + blk.Evidence = EvidenceData{Evidence: []Evidence{&PotentialAmnesiaEvidence{}}} + }, true}, } for i, tc := range testCases { tc := tc