Skip to content

Commit

Permalink
Replace deprecated peer.IDB58Decode
Browse files Browse the repository at this point in the history
The aforementioned `peer.IDB58Decode` was
deprecated and removed in `v0.9.0` of
`go-libp2p-core`. The recommended replacement
is `peer.Decode`. See:
libp2p/go-libp2p-core#205
  • Loading branch information
lukasz-zimnoch committed Sep 28, 2021
1 parent 990f0b8 commit b02f7ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/net/libp2p/libp2p.go
Expand Up @@ -168,7 +168,7 @@ func (cm *connectionManager) ConnectedPeers() []string {
}

func (cm *connectionManager) GetPeerPublicKey(connectedPeer string) (*key.NetworkPublic, error) {
peerID, err := peer.IDB58Decode(connectedPeer)
peerID, err := peer.Decode(connectedPeer)
if err != nil {
return nil, fmt.Errorf(
"failed to decode peer ID from [%s]: [%v]",
Expand All @@ -190,7 +190,7 @@ func (cm *connectionManager) GetPeerPublicKey(connectedPeer string) (*key.Networ
}

func (cm *connectionManager) DisconnectPeer(peerHash string) {
peerID, err := peer.IDB58Decode(peerHash)
peerID, err := peer.Decode(peerHash)
if err != nil {
logger.Errorf("failed to decode peer hash [%v]: [%v]", peerHash, err)
return
Expand Down
4 changes: 2 additions & 2 deletions pkg/net/libp2p/unicast_channel_manager.go
Expand Up @@ -138,7 +138,7 @@ func (ucm *unicastChannelManager) getUnicastChannel(
func (ucm *unicastChannelManager) newUnicastChannel(
peerID net.TransportIdentifier,
) (*unicastChannel, error) {
remotePeer, err := peer.IDB58Decode(peerID.String())
remotePeer, err := peer.Decode(peerID.String())
if err != nil {
return nil, fmt.Errorf("invalid peer ID: [%v]", err)
}
Expand All @@ -159,7 +159,7 @@ func (ucm *unicastChannelManager) newUnicastChannel(
}

func (ucm *unicastChannelManager) trialHandshake(peerID net.TransportIdentifier) error {
remotePeer, err := peer.IDB58Decode(peerID.String())
remotePeer, err := peer.Decode(peerID.String())
if err != nil {
return err
}
Expand Down

0 comments on commit b02f7ff

Please sign in to comment.