Commit 4022f9b6 authored by Andreas Bigger's avatar Andreas Bigger

reset wiped bands not scores

parent 1e5a6e7d
...@@ -286,6 +286,7 @@ var p2pFlags = []cli.Flag{ ...@@ -286,6 +286,7 @@ var p2pFlags = []cli.Flag{
P2PPrivPath, P2PPrivPath,
P2PPrivRaw, P2PPrivRaw,
PeerScoring, PeerScoring,
PeerScoreBands,
Banning, Banning,
TopicScoring, TopicScoring,
ListenIP, ListenIP,
......
...@@ -137,17 +137,10 @@ func NewScorer(peerGater PeerGater, peerStore Peerstore, metricer GossipMetricer ...@@ -137,17 +137,10 @@ func NewScorer(peerGater PeerGater, peerStore Peerstore, metricer GossipMetricer
// The returned [pubsub.ExtendedPeerScoreInspectFn] is called with a mapping of peer IDs to peer score snapshots. // The returned [pubsub.ExtendedPeerScoreInspectFn] is called with a mapping of peer IDs to peer score snapshots.
func (s *scorer) SnapshotHook() pubsub.ExtendedPeerScoreInspectFn { func (s *scorer) SnapshotHook() pubsub.ExtendedPeerScoreInspectFn {
return func(m map[peer.ID]*pubsub.PeerScoreSnapshot) { return func(m map[peer.ID]*pubsub.PeerScoreSnapshot) {
// Reset the score bands
s.bandScoreThresholds.Reset()
// First clear the peer score bands
scoreMap := make(map[string]float64) scoreMap := make(map[string]float64)
for id, snap := range m { for id, snap := range m {
// Increment the bucket for the peer's score
band := s.bandScoreThresholds.Bucket(snap.Score) band := s.bandScoreThresholds.Bucket(snap.Score)
scoreMap[band] += 1 scoreMap[band] += 1
// Update with the peer gater
s.gater.Update(id, snap.Score) s.gater.Update(id, snap.Score)
} }
s.metricer.SetPeerScores(scoreMap) s.metricer.SetPeerScores(scoreMap)
......
...@@ -63,6 +63,7 @@ services: ...@@ -63,6 +63,7 @@ services:
--p2p.listen.udp=9003 --p2p.listen.udp=9003
--p2p.scoring.peers=light --p2p.scoring.peers=light
--p2p.ban.peers=true --p2p.ban.peers=true
--p2p.score.bands="-40:graylist;-20:restricted;0:nopx;20:friend;"
--snapshotlog.file=/op_log/snapshot.log --snapshotlog.file=/op_log/snapshot.log
--p2p.priv.path=/config/p2p-node-key.txt --p2p.priv.path=/config/p2p-node-key.txt
--metrics.enabled --metrics.enabled
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment