make p4 quadratic

This commit is contained in:
vyzo 2020-05-08 19:59:33 +03:00
parent 883f8b8c92
commit 1c85190323
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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
}