libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
309 stars 178 forks source link

`SetTopicScoreParams` after join a new pubsub topic #533

Closed richard-ramos closed 10 months ago

richard-ramos commented 1 year ago

I noticed here that if a topic has not been setup before as part of the WithPeerScore option, then the exist variable will always be false, so it seems that it isn't it possible to set the TopicScoreParams with SetTopicScoreParams for new topics after GossipSub has been instantiated.

    old, exist := ps.params.Topics[topic]
    ps.params.Topics[topic] = p

    if !exist {
        return nil
    }

Is this a bug or intended behavior? because if remove the if !exist { condition, the logic seems to work fine when joining any new pubsub topic.

vyzo commented 1 year ago

Hrm, i think we can call it a bug; pr welcome.