Trong đoạn lệnh dưới đây thì
ev, ok := ev.(types.DuplicateVoteEvidence)
có nghĩa là gì nhỉ? Nó là gọi hàm hay là gì nhỉ?
type Evidence interface {
ABCI() []abci.Evidence // forms individual evidence to be sent to the application
Bytes() []byte // bytes which comprise the evidence
Hash() []byte // hash of the evidence
Height() int64 // height of the infraction
String() string // string format of the evidence
Time() time.Time // time of the infraction
ValidateBasic() error // basic consistency check
}
type DuplicateVoteEvidence struct {
VoteA *Vote `json:"vote_a"`
VoteB *Vote `json:"vote_b"`
// abci specific information
TotalVotingPower int64
ValidatorPower int64
Timestamp time.Time
}
evidenceFromEachValidator := make([]types.Evidence, nValidators)
// set giá trị cho evidenceFromEachValidator
for idx, ev := range evidenceFromEachValidator {
ev, ok := ev.(*types.DuplicateVoteEvidence)
}