mirror of https://github.com/waku-org/nwaku.git
chore(networking): lower dhigh to limit amplification factor (#2168)
This commit is contained in:
parent
282c2e8107
commit
f0f69b3235
|
@ -72,7 +72,7 @@ const GossipsubParameters = GossipSubParams(
|
||||||
|
|
||||||
d: 6,
|
d: 6,
|
||||||
dLow: 4,
|
dLow: 4,
|
||||||
dHigh: 12,
|
dHigh: 8,
|
||||||
dScore: 6,
|
dScore: 6,
|
||||||
dOut: 3,
|
dOut: 3,
|
||||||
dLazy: 6,
|
dLazy: 6,
|
||||||
|
@ -174,8 +174,8 @@ proc new*(T: type WakuRelay, switch: Switch): WakuRelayResult[T] =
|
||||||
|
|
||||||
return ok(w)
|
return ok(w)
|
||||||
|
|
||||||
proc addValidator*(w: WakuRelay,
|
proc addValidator*(w: WakuRelay,
|
||||||
topic: varargs[string],
|
topic: varargs[string],
|
||||||
handler: WakuValidatorHandler) {.gcsafe.} =
|
handler: WakuValidatorHandler) {.gcsafe.} =
|
||||||
for t in topic:
|
for t in topic:
|
||||||
w.wakuValidators.mgetOrPut(t, @[]).add(handler)
|
w.wakuValidators.mgetOrPut(t, @[]).add(handler)
|
||||||
|
@ -196,7 +196,7 @@ proc subscribedTopics*(w: WakuRelay): seq[PubsubTopic] =
|
||||||
|
|
||||||
proc generateOrderedValidator*(w: WakuRelay): auto {.gcsafe.} =
|
proc generateOrderedValidator*(w: WakuRelay): auto {.gcsafe.} =
|
||||||
# rejects messages that are not WakuMessage
|
# rejects messages that are not WakuMessage
|
||||||
let wrappedValidator = proc(pubsubTopic: string,
|
let wrappedValidator = proc(pubsubTopic: string,
|
||||||
message: messages.Message): Future[ValidationResult] {.async.} =
|
message: messages.Message): Future[ValidationResult] {.async.} =
|
||||||
# can be optimized by checking if the message is a WakuMessage without allocating memory
|
# can be optimized by checking if the message is a WakuMessage without allocating memory
|
||||||
# see nim-libp2p protobuf library
|
# see nim-libp2p protobuf library
|
||||||
|
@ -245,7 +245,7 @@ proc subscribe*(w: WakuRelay, pubsubTopic: PubsubTopic, handler: WakuRelayHandle
|
||||||
|
|
||||||
proc unsubscribeAll*(w: WakuRelay, pubsubTopic: PubsubTopic) =
|
proc unsubscribeAll*(w: WakuRelay, pubsubTopic: PubsubTopic) =
|
||||||
## Unsubscribe all handlers on this pubsub topic
|
## Unsubscribe all handlers on this pubsub topic
|
||||||
|
|
||||||
debug "unsubscribe all", pubsubTopic=pubsubTopic
|
debug "unsubscribe all", pubsubTopic=pubsubTopic
|
||||||
|
|
||||||
procCall GossipSub(w).unsubscribeAll(pubsubTopic)
|
procCall GossipSub(w).unsubscribeAll(pubsubTopic)
|
||||||
|
@ -253,7 +253,7 @@ proc unsubscribeAll*(w: WakuRelay, pubsubTopic: PubsubTopic) =
|
||||||
|
|
||||||
proc unsubscribe*(w: WakuRelay, pubsubTopic: PubsubTopic, handler: TopicHandler) =
|
proc unsubscribe*(w: WakuRelay, pubsubTopic: PubsubTopic, handler: TopicHandler) =
|
||||||
## Unsubscribe this handler on this pubsub topic
|
## Unsubscribe this handler on this pubsub topic
|
||||||
|
|
||||||
debug "unsubscribe", pubsubTopic=pubsubTopic
|
debug "unsubscribe", pubsubTopic=pubsubTopic
|
||||||
|
|
||||||
procCall GossipSub(w).unsubscribe(pubsubTopic, handler)
|
procCall GossipSub(w).unsubscribe(pubsubTopic, handler)
|
||||||
|
|
Loading…
Reference in New Issue