File tree 3 files changed +8
-12
lines changed
3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -170,11 +170,11 @@ func (kb dbKeybase) List() ([]Info, error) {
170
170
171
171
// HasByNameOrAddress checks if a key with the name or bech32 string address is in the keybase.
172
172
func (kb dbKeybase ) HasByNameOrAddress (nameOrBech32 string ) (bool , error ) {
173
- has , err := kb . HasByAddress (nameOrBech32 )
173
+ address , err := crypto . AddressFromBech32 (nameOrBech32 )
174
174
if err != nil {
175
175
return kb .HasByName (nameOrBech32 )
176
176
} else {
177
- return has , nil
177
+ return kb . HasByAddress ( address )
178
178
}
179
179
}
180
180
@@ -183,13 +183,9 @@ func (kb dbKeybase) HasByName(name string) (bool, error) {
183
183
return kb .db .Has (infoKey (name )), nil
184
184
}
185
185
186
- // HasByAddress checks if a key with the bech32 string address is in the keybase.
187
- func (kb dbKeybase ) HasByAddress (bech32Address string ) (bool , error ) {
188
- addr , err := crypto .AddressFromBech32 (bech32Address )
189
- if err != nil {
190
- return false , err
191
- }
192
- return kb .db .Has (addrKey (addr )), nil
186
+ // HasByAddress checks if a key with the address is in the keybase.
187
+ func (kb dbKeybase ) HasByAddress (address crypto.Address ) (bool , error ) {
188
+ return kb .db .Has (addrKey (address )), nil
193
189
}
194
190
195
191
// Get returns the public information about one key.
Original file line number Diff line number Diff line change @@ -57,14 +57,14 @@ func (lkb lazyKeybase) HasByName(name string) (bool, error) {
57
57
return NewDBKeybase (db ).HasByName (name )
58
58
}
59
59
60
- func (lkb lazyKeybase ) HasByAddress (bech32Address string ) (bool , error ) {
60
+ func (lkb lazyKeybase ) HasByAddress (address crypto. Address ) (bool , error ) {
61
61
db , err := db .NewDB (lkb .name , dbBackend , lkb .dir )
62
62
if err != nil {
63
63
return false , err
64
64
}
65
65
defer db .Close ()
66
66
67
- return NewDBKeybase (db ).HasByAddress (bech32Address )
67
+ return NewDBKeybase (db ).HasByAddress (address )
68
68
}
69
69
70
70
func (lkb lazyKeybase ) GetByNameOrAddress (nameOrBech32 string ) (Info , error ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ type Keybase interface {
15
15
List () ([]Info , error )
16
16
HasByNameOrAddress (nameOrBech32 string ) (bool , error )
17
17
HasByName (name string ) (bool , error )
18
- HasByAddress (bech32Address string ) (bool , error )
18
+ HasByAddress (address crypto. Address ) (bool , error )
19
19
GetByNameOrAddress (nameOrBech32 string ) (Info , error )
20
20
GetByName (name string ) (Info , error )
21
21
GetByAddress (address crypto.Address ) (Info , error )
You can’t perform that action at this time.
0 commit comments