mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 21:14:53 +00:00
evidence: structs can independently form abci evidence (#5610)
This commit is contained in:
@@ -73,9 +73,9 @@ 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(types.Evidence, time.Time, *types.ValidatorSet) error
|
||||
// Adds consensus based evidence to the evidence pool. This function differs to
|
||||
// AddEvidence by bypassing verification and adding it immediately to the pool
|
||||
AddEvidenceFromConsensus(types.Evidence) error
|
||||
}
|
||||
|
||||
// State handles execution of the consensus algorithm.
|
||||
@@ -1871,13 +1871,14 @@ func (cs *State) tryAddVote(vote *types.Vote, peerID p2p.ID) (bool, error) {
|
||||
} else {
|
||||
timestamp = sm.MedianTime(cs.LastCommit.MakeCommit(), cs.LastValidators)
|
||||
}
|
||||
evidence := types.NewDuplicateVoteEvidence(voteErr.VoteA, voteErr.VoteB)
|
||||
evidenceErr := cs.evpool.AddEvidenceFromConsensus(evidence, timestamp, cs.Validators)
|
||||
|
||||
// form duplicate vote evidence from the conflicting votes and send it across to the
|
||||
// evidence pool
|
||||
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)
|
||||
} else {
|
||||
cs.Logger.Debug("Added evidence to the evidence pool", "evidence", evidence)
|
||||
cs.Logger.Debug("Added evidence to the evidence pool", "ev", ev)
|
||||
}
|
||||
return added, err
|
||||
} else if err == types.ErrVoteNonDeterministicSignature {
|
||||
|
||||
Reference in New Issue
Block a user