addressed Jae's comments

This commit is contained in:
Sunny Aggarwal
2018-08-22 00:15:18 -07:00
parent 0134c3b7f1
commit 97f7b88a9f
3 changed files with 28 additions and 22 deletions
+14 -2
View File
@@ -111,13 +111,19 @@ func (bz AccAddress) Format(s fmt.State, verb rune) {
// Returns boolean for whether two AccAddresses are Equal
func (bz AccAddress) Equals(bz2 AccAddress) bool {
if bz.Empty() && bz2.Empty() {
return true
}
return (bytes.Compare(bz.Bytes(), bz2.Bytes()) == 0)
}
// Returns boolean for whether an AccAddress is empty
func (bz AccAddress) Empty() bool {
if bz == nil {
return true
}
bz2 := AccAddress{}
return bz.Equals(bz2)
return (bytes.Compare(bz.Bytes(), bz2.Bytes()) == 0)
}
//__________________________________________________________
@@ -206,13 +212,19 @@ func (bz ValAddress) Format(s fmt.State, verb rune) {
// Returns boolean for whether two ValAddresses are Equal
func (bz ValAddress) Equals(bz2 ValAddress) bool {
if bz.Empty() && bz2.Empty() {
return true
}
return (bytes.Compare(bz.Bytes(), bz2.Bytes()) == 0)
}
// Returns boolean for whether an AccAddress is empty
func (bz ValAddress) Empty() bool {
if bz == nil {
return true
}
bz2 := ValAddress{}
return bz.Equals(bz2)
return (bytes.Compare(bz.Bytes(), bz2.Bytes()) == 0)
}
// Bech32ifyAccPub takes AccountPubKey and returns the bech32 encoded string