func (evpool *EvidencePool) AddEvidence(evidence types.Evidence) (err error) {
	if err := sm.VerifyEvidence(evpool.stateDB, evpool.State(), evidence); err != nil {
		return err
	}
	valset, _ := sm.LoadValidators(evpool.stateDB, evidence.Height())
	_, val := valset.GetByAddress(evidence.Address())
	priority := val.VotingPower
	added := evpool.evidenceStore.AddNewEvidence(evidence, priority)
	if !added {
		return
	}
	evpool.logger.Info("Verified new evidence of byzantine behaviour", "evidence", evidence)
	evpool.evidenceList.PushBack(evidence)
	return nil
}
AddEvidence checks the evidence is valid and adds it to the pool.
package evidence
import (
	"fmt"
	"sync"
	clist "github.com/tendermint/tendermint/libs/clist"
	dbm "github.com/tendermint/tendermint/libs/db"
	"github.com/tendermint/tendermint/libs/log"
	sm "github.com/tendermint/tendermint/state"
	"github.com/tendermint/tendermint/types"
)
type EvidencePool struct {
	logger log.Logger
	evidenceStore *EvidenceStore
	evidenceList  *clist.CList  
	stateDB dbm.DB
	mtx   sync.Mutex
	state sm.State
}
func NewEvidencePool(stateDB dbm.DB, evidenceStore *EvidenceStore) *EvidencePool {
	evpool := &EvidencePool{
		stateDB:       stateDB,
		state:         sm.LoadState(stateDB),
		logger:        log.NewNopLogger(),
		evidenceStore: evidenceStore,
		evidenceList:  clist.New(),
	}
	return evpool
}
func (evpool *EvidencePool) EvidenceFront() *clist.CElement {
	return evpool.evidenceList.Front()
}
func (evpool *EvidencePool) EvidenceWaitChan() <-chan struct{} {
	return evpool.evidenceList.WaitChan()
}
func (evpool *EvidencePool) SetLogger(l log.Logger) {
	evpool.logger = l
}
func (evpool *EvidencePool) PriorityEvidence() []types.Evidence {
	return evpool.evidenceStore.PriorityEvidence()
}
func (evpool *EvidencePool) PendingEvidence() []types.Evidence {
	return evpool.evidenceStore.PendingEvidence()
}
func (evpool *EvidencePool) State() sm.State {
	evpool.mtx.Lock()
	defer evpool.mtx.Unlock()
	return evpool.state
}
func (evpool *EvidencePool) Update(block *types.Block, state sm.State) {
	if state.LastBlockHeight != block.Height {
		panic(fmt.Sprintf("Failed EvidencePool.Update sanity check: got state.Height=%d with block.Height=%d", state.LastBlockHeight, block.Height))
	}
	evpool.mtx.Lock()
	evpool.state = state
	evpool.mtx.Unlock()
	evpool.MarkEvidenceAsCommitted(block.Height, block.Evidence.Evidence)
}