fix: remove explicit param from GossipSubParams constructor (#1080)

This commit is contained in:
diegomrsantos 2024-04-09 20:14:59 +02:00 committed by GitHub
parent 09b3e11956
commit 89cad5a3ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,6 @@ when defined(libp2p_expensive_metrics):
proc init*(
_: type[GossipSubParams],
explicit = true,
pruneBackoff = 1.minutes,
unsubscribeBackoff = 5.seconds,
floodPublish = true,

View File

@ -102,6 +102,11 @@ type
behaviourPenalty*: float64 # the eventual penalty score
GossipSubParams* {.public.} = object
# explicit is used to check if the GossipSubParams instance was created by the user either passing params to GossipSubParams(...)
# or GossipSubParams.init(...). In the first case explicit should be set to true when calling the Nim constructor.
# In the second case, the param isn't necessary and should be always be set to true by init.
# If none of those options were used, it means the instance was created using Nim default values.
# In this case, GossipSubParams.init() should be called when initing GossipSub to set the values to their default value defined by nim-libp2p.
explicit*: bool
pruneBackoff*: Duration
unsubscribeBackoff*: Duration