waku/v2/protocol/relay/waku_relay.go
WakuRelay
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
type WakuRelay struct {
host host.Host
relayParams *relayParameters
pubsub *pubsub.PubSub
params pubsub.GossipSubParams
Method WakuRelay.Publish
has 12 return statements (exceeds 4 allowed). Open
Open
func (w *WakuRelay) Publish(ctx context.Context, message *pb.WakuMessage, opts ...PublishOption) (pb.MessageHash, error) {
// Publish a `WakuMessage` to a PubSub topic.
if w.pubsub == nil {
return pb.MessageHash{}, errors.New("PubSub hasn't been set")
}
Function NewWakuRelay
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesource.Timesource,
reg prometheus.Registerer, log *zap.Logger, opts ...RelayOption) *WakuRelay {
Method WakuRelay.upsertTopic
has 5 return statements (exceeds 4 allowed). Open
Open
func (w *WakuRelay) upsertTopic(topic string) (*pubsub.Topic, error) {
topicData, ok := w.topics[topic]
if !ok { // Joins topic if node hasn't joined yet
err := w.pubsub.RegisterTopicValidator(topic, w.topicValidator(topic))
if err != nil {
Method WakuRelay.subscribeToPubsubTopic
has 5 return statements (exceeds 4 allowed). Open
Open
func (w *WakuRelay) subscribeToPubsubTopic(topic string) (*pubsubTopicSubscriptionDetails, error) {
w.topicsMutex.Lock()
defer w.topicsMutex.Unlock()
w.log.Info("subscribing to underlying pubsubTopic", zap.String("pubsubTopic", topic))