parent
e4db5f8dcd
commit
37ce4e549e
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/go-amino"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/merkle"
|
||||
|
|
|
@ -36,7 +36,7 @@ func TestEvidence(t *testing.T) {
|
|||
blockID3 := makeBlockID("blockhash", 10000, "partshash")
|
||||
blockID4 := makeBlockID("blockhash", 10000, "partshash2")
|
||||
|
||||
chainID := "mychain"
|
||||
const chainID = "mychain"
|
||||
|
||||
vote1 := makeVote(val, chainID, 0, 10, 2, 1, blockID)
|
||||
badVote := makeVote(val, chainID, 0, 10, 2, 1, blockID)
|
||||
|
@ -72,3 +72,30 @@ func TestEvidence(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDuplicatedVoteEvidence(t *testing.T) {
|
||||
ev := randomDuplicatedVoteEvidence()
|
||||
|
||||
assert.True(t, ev.Equal(ev))
|
||||
assert.False(t, ev.Equal(&DuplicateVoteEvidence{}))
|
||||
}
|
||||
|
||||
func TestEvidenceList(t *testing.T) {
|
||||
ev := randomDuplicatedVoteEvidence()
|
||||
evl := EvidenceList([]Evidence{ev})
|
||||
|
||||
assert.NotNil(t, evl.Hash())
|
||||
assert.True(t, evl.Has(ev))
|
||||
assert.False(t, evl.Has(&DuplicateVoteEvidence{}))
|
||||
}
|
||||
|
||||
func randomDuplicatedVoteEvidence() *DuplicateVoteEvidence {
|
||||
val := NewMockPV()
|
||||
blockID := makeBlockID("blockhash", 1000, "partshash")
|
||||
blockID2 := makeBlockID("blockhash2", 1000, "partshash")
|
||||
const chainID = "mychain"
|
||||
return &DuplicateVoteEvidence{
|
||||
VoteA: makeVote(val, chainID, 0, 10, 2, 1, blockID),
|
||||
VoteB: makeVote(val, chainID, 0, 10, 2, 1, blockID2),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue