diff --git a/node/peer.go b/node/peer.go index 5054949..76f4ee3 100644 --- a/node/peer.go +++ b/node/peer.go @@ -75,9 +75,6 @@ func safeKeyPrefix(key string) string { // Peer names must be 1-64 characters, start and end with alphanumeric, // and contain only alphanumeric, hyphens, underscores, and spaces. func validatePeerName(name string) error { - if name == "" { - return nil // Empty names are allowed (optional field) - } if len(name) < PeerNameMinLength { return coreerr.E("validatePeerName", "peer name too short", nil) } diff --git a/node/peer_test.go b/node/peer_test.go index 7960f6f..393492b 100644 --- a/node/peer_test.go +++ b/node/peer_test.go @@ -543,7 +543,7 @@ func TestPeerRegistry_PeerNameValidation(t *testing.T) { peerName string shouldErr bool }{ - {"empty name allowed", "", false}, + {"empty name rejected", "", true}, {"single char", "A", false}, {"simple name", "MyPeer", false}, {"name with hyphen", "my-peer", false}, @@ -697,7 +697,7 @@ func TestValidatePeerName(t *testing.T) { peerName string shouldErr bool }{ - {"empty allowed", "", false}, + {"empty rejected", "", true}, {"single alphanumeric", "A", false}, {"simple alphanumeric", "TestPeer", false}, {"with hyphens", "test-peer", false},