From 1b94c3feda631e39b958a10fa05e4123a8a23900 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Tue, 1 Jun 2021 18:06:08 -0600 Subject: [PATCH] fix #581 (#583) --- libp2p/protocols/pubsub/gossipsub/scoring.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libp2p/protocols/pubsub/gossipsub/scoring.nim b/libp2p/protocols/pubsub/gossipsub/scoring.nim index 79ff50a39..a8a65166d 100644 --- a/libp2p/protocols/pubsub/gossipsub/scoring.nim +++ b/libp2p/protocols/pubsub/gossipsub/scoring.nim @@ -288,7 +288,8 @@ proc updateScores*(g: GossipSub) = # avoid async trace "updated scores", peers = g.peers.len proc punishInvalidMessage*(g: GossipSub, peer: PubSubPeer, topics: seq[string]) = - for t in topics: + for tt in topics: + let t = tt if t notin g.topics: continue @@ -301,7 +302,8 @@ proc addCapped*[T](stat: var T, diff, cap: T) = proc rewardDelivered*( g: GossipSub, peer: PubSubPeer, topics: openArray[string], first: bool) = - for t in topics: + for tt in topics: + let t = tt if t notin g.topics: continue let topicParams = g.topicParams.mgetOrPut(t, TopicParams.init())