mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 06:15:33 +00:00
use correct source of evidence time
Conflicting votes are now sent to the evidence pool to form duplicate vote evidence only once the height of the evidence is finished and the time of the block finalised.
This commit is contained in:
@@ -465,9 +465,8 @@ type txNotifier interface {
|
||||
|
||||
// interface to the evidence pool
|
||||
type evidencePool interface {
|
||||
// Adds consensus based evidence to the evidence pool where time is the time
|
||||
// of the block where the offense occurred and the validator set is the current one.
|
||||
AddEvidenceFromConsensus(evidence types.Evidence) error
|
||||
// reports conflicting votes to the evidence pool to be processed into evidence
|
||||
ReportConflictingVotes(voteA, voteB *types.Vote)
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
@@ -1767,17 +1766,7 @@ func (cs *State) tryAddVote(vote *types.Vote, peerID p2p.ID) (bool, error) {
|
||||
vote.Type)
|
||||
return added, err
|
||||
}
|
||||
var timestamp time.Time
|
||||
if voteErr.VoteA.Height == cs.state.InitialHeight {
|
||||
timestamp = cs.state.LastBlockTime // genesis time
|
||||
} else {
|
||||
timestamp = sm.MedianTime(cs.LastCommit.MakeCommit(), cs.LastValidators)
|
||||
}
|
||||
ev := types.NewDuplicateVoteEvidence(voteErr.VoteA, voteErr.VoteB, timestamp, cs.Validators)
|
||||
evidenceErr := cs.evpool.AddEvidenceFromConsensus(ev)
|
||||
if evidenceErr != nil {
|
||||
cs.Logger.Error("Failed to add evidence to the evidence pool", "err", evidenceErr)
|
||||
}
|
||||
cs.evpool.ReportConflictingVotes(voteErr.VoteA, voteErr.VoteB)
|
||||
return added, err
|
||||
} else if err == types.ErrVoteNonDeterministicSignature {
|
||||
cs.Logger.Debug("Vote has non-deterministic signature", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user