From 463708aeab2b65ddb0a8e6d98aa8d26ecc30cf9c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 08:16:44 +0100 Subject: [PATCH] ax(node): promote peer selection weights from var to const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/node/peer.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/node/peer.go b/pkg/node/peer.go index 7b79055..cba08f2 100644 --- a/pkg/node/peer.go +++ b/pkg/node/peer.go @@ -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.