What changed, and why it matters
This commit fixes a small bug in how the btcd Bitcoin node software cleans up version strings. Previously, dots in pre-release version labels like 'beta.rc1' were accidentally removed, turning them into 'betarc1'. The change adds dots to the allowed character set and adds a test to prevent regression. It is a correctness fix with no direct security impact visible in the code.
No security action required. Treat as a routine correctness/regression-test improvement. Reviewers may optionally verify that normalizeVerString is only used for display or local version metadata and not for protocol version negotiation.
Security signals we found
No security-relevant signals in commit message or diff
Change is a string-normalization correctness fix
No input from untrusted network sources is processed by this code path
No memory-unsafe, cryptographic, or authorization changes
Evidence from the diff
The normalizeVerString function in version.go filters version strings to a permitted alphabet. The semanticAlphabet constant previously omitted ‘.’, causing dotted Semantic Versioning pre-release identifiers (e.g., ‘beta.rc1’) to be collapsed. The patch adds ‘.’ to semanticAlphabet and introduces version_test.go with a focused regression test. The change is local to version-string normalization and does not alter network, consensus, or cryptographic logic.
Changed components
version.go: semanticAlphabet constantversion.go: normalizeVerString functionversion_test.go: new regression testInspect captured patch +20 / −1
diff --git a/version.go b/version.go
index d63de6f..96b7fda 100644
--- a/version.go
+++ b/version.go
@@ -11,7 +11,7 @@ import (
)
// semanticAlphabet
-const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"
+const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-."
// These constants define the application version and follow the semantic
// versioning 2.0.0 spec (http://semver.org/).
diff --git a/version_test.go b/version_test.go
new file mode 100644
index 0000000..d4e1c28
--- /dev/null
+++ b/version_test.go
@@ -0,0 +1,19 @@
+// Copyright (c) 2026 The btcsuite developers
+// Use of this source code is governed by an ISC
+// license that can be found in the LICENSE file.
+
+package main
+
+import "testing"
+
+// TestNormalizeVerString ensures valid semantic version separators are
+// preserved when normalizing pre-release and build metadata strings.
+func TestNormalizeVerString(t *testing.T) {
+ t.Parallel()
+
+ const version = "beta.rc1"
+ if got := normalizeVerString(version); got != version {
+ t.Fatalf("unexpected normalized version: got %q, want %q", got,
+ version)
+ }
+}
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.