ax(node): promote peer selection weights from var to const

Dimension weights are never reassigned — declaring them as mutable vars
implies changeability that does not exist. Const declares what IS (AX §5).

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 08:16:44 +01:00
parent 8d89df10cc
commit 463708aeab
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -107,13 +107,13 @@ type PeerRegistry struct {
saveStopOnce sync.Once // Ensure stopChan is closed only once
}
// Dimension weights for peer selection
// Lower ping, hops, geographic distance are better; higher score is better
var (
pingWeight = 1.0
hopsWeight = 0.7
geographicWeight = 0.2
scoreWeight = 1.2
// Dimension weights for peer selection.
// Lower ping, hops, geographic distance are better; higher score is better.
const (
pingWeight = 1.0
hopsWeight = 0.7
geographicWeight = 0.2
scoreWeight = 1.2
)
// NewPeerRegistry creates a new PeerRegistry, loading existing peers if available.