Various gossipsub fixes (#827)
This commit is contained in:
parent
8d5ea43e2b
commit
bac754e2ad
|
@ -130,6 +130,10 @@ proc handleGraft*(g: GossipSub,
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if g.mesh.hasPeer(topic, peer):
|
||||||
|
trace "peer already in mesh", peer, topic
|
||||||
|
continue
|
||||||
|
|
||||||
# Check backingOff
|
# Check backingOff
|
||||||
# Ignore BackoffSlackTime here, since this only for outbound activity
|
# Ignore BackoffSlackTime here, since this only for outbound activity
|
||||||
# and subtract a second time to avoid race conditions
|
# and subtract a second time to avoid race conditions
|
||||||
|
@ -176,6 +180,10 @@ proc handleGraft*(g: GossipSub,
|
||||||
topicID: topic,
|
topicID: topic,
|
||||||
peers: g.peerExchangeList(topic),
|
peers: g.peerExchangeList(topic),
|
||||||
backoff: g.parameters.pruneBackoff.seconds.uint64))
|
backoff: g.parameters.pruneBackoff.seconds.uint64))
|
||||||
|
|
||||||
|
let backoff = Moment.fromNow(g.parameters.pruneBackoff)
|
||||||
|
g.backingOff
|
||||||
|
.mgetOrPut(topic, initTable[PeerId, Moment]())[peer.peerId] = backoff
|
||||||
else:
|
else:
|
||||||
trace "peer grafting topic we're not interested in", peer, topic
|
trace "peer grafting topic we're not interested in", peer, topic
|
||||||
# gossip 1.1, we do not send a control message prune anymore
|
# gossip 1.1, we do not send a control message prune anymore
|
||||||
|
|
|
@ -295,11 +295,11 @@ proc rewardDelivered*(
|
||||||
|
|
||||||
g.withPeerStats(peer.peerId) do (stats: var PeerStats):
|
g.withPeerStats(peer.peerId) do (stats: var PeerStats):
|
||||||
stats.topicInfos.withValue(tt, tstats):
|
stats.topicInfos.withValue(tt, tstats):
|
||||||
if tstats[].inMesh:
|
if first:
|
||||||
if first:
|
tstats[].firstMessageDeliveries.addCapped(
|
||||||
tstats[].firstMessageDeliveries.addCapped(
|
1, topicParams.firstMessageDeliveriesCap)
|
||||||
1, topicParams.firstMessageDeliveriesCap)
|
|
||||||
|
|
||||||
|
if tstats[].inMesh:
|
||||||
tstats[].meshMessageDeliveries.addCapped(
|
tstats[].meshMessageDeliveries.addCapped(
|
||||||
1, topicParams.meshMessageDeliveriesCap)
|
1, topicParams.meshMessageDeliveriesCap)
|
||||||
do: # make sure we don't loose this information
|
do: # make sure we don't loose this information
|
||||||
|
|
Loading…
Reference in New Issue