kadence/churnfilter~ ChurnFilterPlugin

Plugin that tracks contacts that are not online and evicts them from the routing table, prevents re-entry into the routing table using an exponential cooldown time.

Constructor

new ChurnFilterPlugin(node, optionsopt)

Parameters:
NameTypeAttributesDescription
nodeAbstractNode
optionsobject<optional>
Properties
NameTypeAttributesDefaultDescription
cooldownMultipliernumber<optional>
2

Multiply cooldown time by this number after every offense

cooldownResetTimestring<optional>
"10M"

Human time string for resetting the cooldown multiplier after no block added for a given peer fingerprint

cooldownBaseTimeoutstring<optional>
"1M"

Human time string for starting timeout, multiplied by two every time the cooldown is reset and broken again

Methods

delBlock(fingerprint)

Deletes the blocked fingerprint

Parameters:
NameTypeDescription
fingerprintstring | buffer

Node ID to remove block

hasBlock(fingerprint) → {boolean}

Checks if the fingerprint is blocked

Parameters:
NameTypeDescription
fingerprintstring | buffer

Node ID to check

Returns:
Type: 
boolean

reset()

Clears all blocked and cooldown data

resetCooldownForStablePeers()

Releases blocked to reset cooldown multipliers for fingerprints with cooldowns that are long expired and not blocked

setBlock(fingerprint) → {object}

Creates a new block or renews the cooldown for an existing block

Parameters:
NameTypeDescription
fingerprintstring | buffer

Node ID to block

Returns:
Type: 
object