Skip to content

Commit d2c9c5b

Browse files
feat: to handle all types of pub keys
1 parent 03165f1 commit d2c9c5b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

rolling-shutter/p2p/floodsubpeerdiscovery/gossippeerdiscovery.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
pubsub "github.com/libp2p/go-libp2p-pubsub"
1010
"github.com/libp2p/go-libp2p/core/crypto"
11-
"github.com/libp2p/go-libp2p/core/crypto/pb"
1211
"github.com/libp2p/go-libp2p/core/peer"
1312
"github.com/libp2p/go-libp2p/core/peerstore"
1413
"github.com/multiformats/go-multiaddr"
@@ -101,7 +100,7 @@ func (pd *FloodsubPeerDiscovery) broadcast() error {
101100
return fmt.Errorf("peerId was missing public key | err %w", err)
102101
}
103102

104-
pubKeyBytes, err := pubKey.Raw()
103+
pubKeyBytes, err := crypto.MarshalPublicKey(pubKey)
105104
if err != nil || len(pubKeyBytes) == 0 {
106105
return fmt.Errorf("peerId was missing public key | err %w", err)
107106
}
@@ -152,7 +151,7 @@ func (pd *FloodsubPeerDiscovery) ReadLoop(ctx context.Context, subs *pubsub.Subs
152151
continue
153152
}
154153

155-
pubKey, err := crypto.PubKeyUnmarshallers[pb.KeyType_Ed25519](peerMsg.PublicKey)
154+
pubKey, err := crypto.UnmarshalPublicKey(peerMsg.PublicKey)
156155
if err != nil {
157156
log.Warn().Msgf("failed to get pub key from floodsub message | %v", err)
158157
continue

0 commit comments

Comments
 (0)