func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.Evidence {
	_, val := valSet.GetByAddress(ev.Address())
	if val == nil {
		// should already have checked this
		panic(val)
	}

	// set type
	var evType string
	switch ev.(type) {
	case *DuplicateVoteEvidence:
		evType = ABCIEvidenceTypeDuplicateVote
	case MockGoodEvidence:
		// XXX: not great to have test types in production paths ...
		evType = ABCIEvidenceTypeMockGood
	default:
		panic(fmt.Sprintf("Unknown evidence type: %v %v", ev, reflect.TypeOf(ev)))
	}

	return abci.Evidence{
		Type:             evType,
		Validator:        TM2PB.Validator(val),
		Height:           ev.Height(),
		Time:             evTime,
		TotalVotingPower: valSet.TotalVotingPower(),
	}
}
// ABCI Evidence includes information from the past that's not included in the evidence itself
// so Evidence types stays compact.
// XXX: panics on nil or unknown pubkey type
ABCI Evidence includes information from the past that's not included in the evidence itself
so Evidence types stays compact.
XXX: panics on nil or unknown pubkey type
// ABCI Evidence includes information from the past that ' s not included in the evidence itself // so Evidence types stays compact . // XXX : panics on nil or unknown pubkey type
func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.Evidence {
	_, val := valSet.GetByAddress(ev.Address())
	if val == nil {
		panic(val)
	}
	var evType string
	switch ev.(type) {
	case *DuplicateVoteEvidence:
		evType = ABCIEvidenceTypeDuplicateVote
	case MockGoodEvidence:
		evType = ABCIEvidenceTypeMockGood
	default:
		panic(fmt.Sprintf("Unknown evidence type: %v %v", ev, reflect.TypeOf(ev)))
	}
	return abci.Evidence{
		Type:             evType,
		Validator:        TM2PB.Validator(val),
		Height:           ev.Height(),
		Time:             evTime,
		TotalVotingPower: valSet.TotalVotingPower(),
	}
}
func ( tm2pb ) Evidence ( ev Evidence , valSet * ValidatorSet , evTime time . Time ) abci . Evidence { _ , val := valSet . GetByAddress ( ev . Address ( ) ) if val == nil { panic ( val ) } var evType string switch ev . ( type ) { case * DuplicateVoteEvidence : evType = ABCIEvidenceTypeDuplicateVote case MockGoodEvidence : evType = ABCIEvidenceTypeMockGood default : panic ( fmt . Sprintf ( " " , ev , reflect . TypeOf ( ev ) ) ) } return abci . Evidence { Type : evType , Validator : TM2PB . Validator ( val ) , Height : ev . Height ( ) , Time : evTime , TotalVotingPower : valSet . TotalVotingPower ( ) , } }
ABCI Evidence includes information from the past that's not included in the evidence itself
so Evidence types stays compact.
ABCI Evidence includes information from the past that ' s not included in the evidence itself so Evidence types stays compact .
// should already have checked this // set type // XXX: not great to have test types in production paths ...