mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2026-08-21 15:23:28 +08:00
update to match new ExtractPublicKey API
This is a "more correct" API and we might as well fix this before it becomes used all over the place. The new API returns ErrNoPublicKey when there is no inlined key. This *also* fixes a bug where the datastore-backed keystore would panic if `ExtractPublicKey` returned `nil, nil`.
This commit is contained in:
@@ -49,7 +49,7 @@ func (mkb *memoryKeyBook) PubKey(p peer.ID) ic.PubKey {
|
||||
return pk
|
||||
}
|
||||
pk, err := p.ExtractPublicKey()
|
||||
if err == nil && pk != nil {
|
||||
if err == nil {
|
||||
mkb.Lock()
|
||||
mkb.pks[p] = pk
|
||||
mkb.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user