Browse Source

add an upperbound to the peer's MutableScore

pull/8137/head
jay tseng 3 years ago
parent
commit
ab4c239853
No known key found for this signature in database GPG Key ID: 5A9D3063305E6427
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      internal/p2p/peermanager.go

+ 4
- 1
internal/p2p/peermanager.go View File

@ -891,7 +891,10 @@ func (m *PeerManager) processPeerEvent(ctx context.Context, pu PeerUpdate) {
case PeerStatusBad: case PeerStatusBad:
m.store.peers[pu.NodeID].MutableScore-- m.store.peers[pu.NodeID].MutableScore--
case PeerStatusGood: case PeerStatusGood:
m.store.peers[pu.NodeID].MutableScore++
// The persistent peer rank won't be affected by the score update.
if m.store.peers[pu.NodeID].MutableScore < int64(MaxPeerScoreNotPersistent) {
m.store.peers[pu.NodeID].MutableScore++
}
} }
} }


Loading…
Cancel
Save