Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-pubsub
Commits
9c0b96f4
Commit
9c0b96f4
authored
Mar 08, 2020
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment cosmetics
parent
e17e266a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
score.go
score.go
+9
-5
No files found.
score.go
View file @
9c0b96f4
...
...
@@ -60,12 +60,16 @@ type TopicScoreParams struct {
// P3: mesh message deliveries
// This is the number of message deliveries in the mesh, within the MeshMessageDeliveriesWindow of
// the first message delivery.
// This window accounts for time in the validation pipeline and the minimum time before a hostile
// mesh peer trying to game the score can replay back a valid message we just sent them.
// It effectively tracks near-first deliveries, ie a message seen from a mesh peer before we
// have forwarded it to them.
// The parameter has an associated counter, decaying with MessageMessageDeliveriesDecay.
// If the counter exceeds the threshold, its value is 0.
// If the counter is below the MeshMessageDeliveriesThreshold, the value is the square of
// the deficit, ie (MessageDeliveriesThreshold - counter)^2
// The penalty is only activated after MeshMessageDeliveriesActivation time in the mesh.
// The weight of the parameter MUST be negative.
// The weight of the parameter MUST be negative
(or zero if you want to disable it)
.
MeshMessageDeliveriesWeight
,
MeshMessageDeliveriesDecay
float64
MeshMessageDeliveriesCap
,
MeshMessageDeliveriesThreshold
float64
MeshMessageDeliveriesWindow
,
MeshMessageDeliveriesActivation
time
.
Duration
...
...
@@ -145,10 +149,10 @@ type deliveryRecord struct {
// delivery record status
const
(
delivery_unknown
=
iota
// we don't know (yet) if the message is valid
delivery_valid
delivery_invalid
delivery_throttled
delivery_unknown
=
iota
// we don't know (yet) if the message is valid
delivery_valid
// we know the message is valid
delivery_invalid
// we know the message is invalid
delivery_throttled
// we can't tell if it is valid because validation throttled
)
func
newPeerScore
(
params
*
PeerScoreParams
)
*
peerScore
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment