From a29fd7c69925749c8b9450a5c03a8fa7cbdbdb02 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 28 Jul 2020 16:04:44 +0400 Subject: [PATCH] proto: add a comment for Validator#Address (#5144) Refs #3732 --- proto/tendermint/abci/types.proto | 4 ++-- types/validator.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index cf637fe75..59309f070 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -332,9 +332,9 @@ message TxResult { // Validator message Validator { - bytes address = 1; + bytes address = 1; // The first 20 bytes of SHA256(public key) // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; + int64 power = 3; // The voting power } // ValidatorUpdate diff --git a/types/validator.go b/types/validator.go index 948151a11..c56a6bc07 100644 --- a/types/validator.go +++ b/types/validator.go @@ -23,6 +23,7 @@ type Validator struct { ProposerPriority int64 `json:"proposer_priority"` } +// NewValidator returns a new validator with the given pubkey and voting power. func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator { return &Validator{ Address: pubKey.Address(), @@ -32,6 +33,7 @@ func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator { } } +// ValidateBasic performs basic validation. func (v *Validator) ValidateBasic() error { if v == nil { return errors.New("nil validator")