Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto: add a comment for Validator#Address #5144

Merged
merged 4 commits into from Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions proto/tendermint/abci/types.proto
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions types/validator.go
Expand Up @@ -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(),
Expand All @@ -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")
Expand Down