Skip to content

Commit 6f64644

Browse files
chore: fixed PR comments
1 parent ad65675 commit 6f64644

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

rolling-shutter/p2p/floodsubpeerdiscovery/gossippeerdiscovery.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ func (pd *FloodsubPeerDiscovery) Init(config PeerDiscoveryComponents, interval i
3636
for _, topic := range topics {
3737
topic, err := pd.Pubsub.Join(topic)
3838
if err != nil {
39-
return fmt.Errorf("failed to join topic | err %v", err)
39+
return fmt.Errorf("failed to join topic | err %w", err)
4040
}
4141
pd.Topics = append(pd.Topics, topic)
4242
}
4343
} else {
4444
topic, err := pd.Pubsub.Join(defaultTopic)
4545
if err != nil {
46-
return fmt.Errorf("failed to join topic | err %v", err)
46+
return fmt.Errorf("failed to join topic | err %w", err)
4747
}
4848
pd.Topics = append(pd.Topics, topic)
4949
}
@@ -58,7 +58,7 @@ func (pd *FloodsubPeerDiscovery) Start(ctx context.Context) error {
5858
case <-timer.C:
5959
err := pd.broadcast()
6060
if err != nil {
61-
log.Info().Msgf("error in broadcasting floodsub msg | %v", err)
61+
log.Warn().Msgf("error in broadcasting floodsub msg | %v", err)
6262
return err
6363
}
6464
case <-ctx.Done():
@@ -70,16 +70,16 @@ func (pd *FloodsubPeerDiscovery) Start(ctx context.Context) error {
7070
func (pd *FloodsubPeerDiscovery) broadcast() error {
7171
pubKey, err := pd.PeerId.ExtractPublicKey()
7272
if err != nil {
73-
return fmt.Errorf("peerId was missing public key | err %v", err)
73+
return fmt.Errorf("peerId was missing public key | err %w", err)
7474
}
7575

7676
pubKeyBytes, err := pubKey.Raw()
7777
if err != nil || len(pubKeyBytes) == 0 {
78-
return fmt.Errorf("peerId was missing public key | err %v", err)
78+
return fmt.Errorf("peerId was missing public key | err %w", err)
7979
}
8080

8181
if pd.Pubsub == nil {
82-
return fmt.Errorf("pubSub not configured | err %v", err)
82+
return fmt.Errorf("pubSub not configured | err %w", err)
8383
}
8484

8585
addresses := make([][]byte, 0)
@@ -94,7 +94,7 @@ func (pd *FloodsubPeerDiscovery) broadcast() error {
9494
}
9595
pbPeer, err := proto.Marshal(&peer)
9696
if err != nil {
97-
return fmt.Errorf("error marshalling message | err %v", err)
97+
return fmt.Errorf("error marshalling message | err %w", err)
9898
}
9999

100100
for _, topic := range pd.Topics {
@@ -105,7 +105,7 @@ func (pd *FloodsubPeerDiscovery) broadcast() error {
105105
log.Info().Msgf("broadcasting our peer data on topic %s", topic)
106106

107107
if err := topic.Publish(context.Background(), pbPeer); err != nil {
108-
return fmt.Errorf("failed to publish to topic | err %v", err)
108+
return fmt.Errorf("failed to publish to topic | err %w", err)
109109
}
110110
defer topic.Close()
111111
}

0 commit comments

Comments
 (0)