Commit 0f6aeb23 authored by vyzo's avatar vyzo

disallow duplicate score inspectors

parent e6559f59
......@@ -152,6 +152,10 @@ func WithPeerScoreInspect(inspect interface{}, period time.Duration) Option {
return fmt.Errorf("peer scoring is not enabled")
}
if gs.score.inspect != nil || gs.score.inspectEx != nil {
return fmt.Errorf("duplicate peer score inspector")
}
switch i := inspect.(type) {
case PeerScoreInspectFn:
gs.score.inspect = i
......@@ -352,7 +356,8 @@ func (ps *peerScore) background(ctx context.Context) {
func (ps *peerScore) inspectScores() {
if ps.inspect != nil {
ps.inspectScoresSimple()
} else if ps.inspectEx != nil {
}
if ps.inspectEx != nil {
ps.inspectScoresExtended()
}
}
......
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