fix: topicscore params can't be set for dynamically subscribed topic (#540)

* fix: topicscore params can't be set for a topic subscribed after gossipsub is initialized

* chore:address review comments
This commit is contained in:
Prem Chaitanya Prathi 2023-08-19 14:51:43 +05:30 committed by GitHub
parent cef801641c
commit aa5fd79a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,13 +202,9 @@ func (ps *peerScore) SetTopicScoreParams(topic string, p *TopicScoreParams) erro
ps.Lock()
defer ps.Unlock()
old, exist := ps.params.Topics[topic]
old := ps.params.Topics[topic]
ps.params.Topics[topic] = p
if !exist {
return nil
}
// check to see if the counter Caps are being lowered; if that's the case we need to recap them
recap := false
if p.FirstMessageDeliveriesCap < old.FirstMessageDeliveriesCap {