Browse Source

proto: add a comment for Validator#Address (#5144)

Refs #3732
pull/5164/head
Anton Kaliaev 4 years ago
committed by GitHub
parent
commit
a29fd7c699
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions
  1. +2
    -2
      proto/tendermint/abci/types.proto
  2. +2
    -0
      types/validator.go

+ 2
- 2
proto/tendermint/abci/types.proto View File

@ -332,9 +332,9 @@ message TxResult {
// Validator // Validator
message Validator { message Validator {
bytes address = 1;
bytes address = 1; // The first 20 bytes of SHA256(public key)
// PubKey pub_key = 2 [(gogoproto.nullable)=false]; // PubKey pub_key = 2 [(gogoproto.nullable)=false];
int64 power = 3;
int64 power = 3; // The voting power
} }
// ValidatorUpdate // ValidatorUpdate


+ 2
- 0
types/validator.go View File

@ -23,6 +23,7 @@ type Validator struct {
ProposerPriority int64 `json:"proposer_priority"` 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 { func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator {
return &Validator{ return &Validator{
Address: pubKey.Address(), Address: pubKey.Address(),
@ -32,6 +33,7 @@ func NewValidator(pubKey crypto.PubKey, votingPower int64) *Validator {
} }
} }
// ValidateBasic performs basic validation.
func (v *Validator) ValidateBasic() error { func (v *Validator) ValidateBasic() error {
if v == nil { if v == nil {
return errors.New("nil validator") return errors.New("nil validator")


Loading…
Cancel
Save