From 1c85190323e30b82774016d89a7882f2a5e5d021 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 8 May 2020 19:59:33 +0300 Subject: [PATCH] make p4 quadratic --- score.go | 2 +- score_params.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/score.go b/score.go index d9633ae..777530e 100644 --- a/score.go +++ b/score.go @@ -219,7 +219,7 @@ func (ps *peerScore) score(p peer.ID) float64 { // P4: invalid messages // NOTE: the weight of P4 is negative (validated in TopicScoreParams.validate), so this detracts. - p4 := tstats.invalidMessageDeliveries + p4 := (tstats.invalidMessageDeliveries * tstats.invalidMessageDeliveries) topicScore += p4 * topicParams.InvalidMessageDeliveriesWeight // update score, mixing with topic weight diff --git a/score_params.go b/score_params.go index 6ee0654..d004de3 100644 --- a/score_params.go +++ b/score_params.go @@ -139,7 +139,8 @@ type TopicScoreParams struct { // P4: invalid messages // This is the number of invalid messages in the topic. - // The value of the parameter is a counter, decaying with InvalidMessageDeliveriesDecay. + // The value of the parameter is the square of the counter, decaying with + // InvalidMessageDeliveriesDecay. // The weight of the parameter MUST be negative (or zero to disable). InvalidMessageDeliveriesWeight, InvalidMessageDeliveriesDecay float64 }