mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-29 04:31:44 +00:00
@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tendermint/go-amino"
|
amino "github.com/tendermint/go-amino"
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/crypto"
|
"github.com/tendermint/tendermint/crypto"
|
||||||
"github.com/tendermint/tendermint/crypto/merkle"
|
"github.com/tendermint/tendermint/crypto/merkle"
|
||||||
|
@ -36,7 +36,7 @@ func TestEvidence(t *testing.T) {
|
|||||||
blockID3 := makeBlockID("blockhash", 10000, "partshash")
|
blockID3 := makeBlockID("blockhash", 10000, "partshash")
|
||||||
blockID4 := makeBlockID("blockhash", 10000, "partshash2")
|
blockID4 := makeBlockID("blockhash", 10000, "partshash2")
|
||||||
|
|
||||||
chainID := "mychain"
|
const chainID = "mychain"
|
||||||
|
|
||||||
vote1 := makeVote(val, chainID, 0, 10, 2, 1, blockID)
|
vote1 := makeVote(val, chainID, 0, 10, 2, 1, blockID)
|
||||||
badVote := 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),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user