Add helper methods for nil checks in structs

This commit is contained in:
Ethan Frey
2017-02-23 15:35:04 +01:00
parent cbe35e07d1
commit b6a2c5949f
3 changed files with 12 additions and 0 deletions

View File

@ -53,6 +53,10 @@ func (p *PrivKeyS) UnmarshalJSON(data []byte) (err error) {
return
}
func (p PrivKeyS) Empty() bool {
return p.PrivKey == nil
}
func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivKey, err error) {
err = wire.ReadBinaryBytes(privKeyBytes, &privKey)
return