Browse Source

Improve method docs

pull/1284/head
Alexander Simmerl 7 years ago
parent
commit
25ff699425
No known key found for this signature in database GPG Key ID: 4694E95C9CC61BDA
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      types/priv_validator/json.go

+ 5
- 2
types/priv_validator/json.go View File

@ -24,12 +24,12 @@ func (pk PrivKey) Sign(msg []byte) (crypto.Signature, error) {
return crypto.PrivKey(pk).Sign(msg), nil return crypto.PrivKey(pk).Sign(msg), nil
} }
// MarshalJSON
// MarshalJSON satisfies json.Marshaler.
func (pk PrivKey) MarshalJSON() ([]byte, error) { func (pk PrivKey) MarshalJSON() ([]byte, error) {
return crypto.PrivKey(pk).MarshalJSON() return crypto.PrivKey(pk).MarshalJSON()
} }
// UnmarshalJSON
// UnmarshalJSON satisfies json.Unmarshaler.
func (pk *PrivKey) UnmarshalJSON(b []byte) error { func (pk *PrivKey) UnmarshalJSON(b []byte) error {
cpk := new(crypto.PrivKey) cpk := new(crypto.PrivKey)
if err := cpk.UnmarshalJSON(b); err != nil { if err := cpk.UnmarshalJSON(b); err != nil {
@ -83,6 +83,7 @@ func (pvj *PrivValidatorJSON) String() string {
return fmt.Sprintf("PrivValidator{%v %v}", addr, pvj.PrivValidatorUnencrypted.String()) return fmt.Sprintf("PrivValidator{%v %v}", addr, pvj.PrivValidatorUnencrypted.String())
} }
// Save persists the PrivValidatorJSON to disk.
func (pvj *PrivValidatorJSON) Save() { func (pvj *PrivValidatorJSON) Save() {
pvj.save() pvj.save()
} }
@ -167,6 +168,8 @@ func NewTestPrivValidator(signer types.TestSigner) *PrivValidatorJSON {
//------------------------------------------------------ //------------------------------------------------------
// PrivValidatorsByAddress is a list of PrivValidatorJSON ordered by their
// addresses.
type PrivValidatorsByAddress []*PrivValidatorJSON type PrivValidatorsByAddress []*PrivValidatorJSON
func (pvs PrivValidatorsByAddress) Len() int { func (pvs PrivValidatorsByAddress) Len() int {


Loading…
Cancel
Save