diff --git a/protocol/handshake/server.go b/protocol/handshake/server.go index 092403fd..68081109 100644 --- a/protocol/handshake/server.go +++ b/protocol/handshake/server.go @@ -17,7 +17,7 @@ package handshake import ( "errors" "fmt" - "sort" + "slices" "github.com/blinklabs-io/gouroboros/protocol" ) @@ -105,9 +105,7 @@ func (s *Server) handleProposeVersions(msg protocol.Message) error { } // sort asending - iterating over map is not deterministic - sort.Slice(supportedVersions, func(i, j int) bool { - return supportedVersions[i] < supportedVersions[j] - }) + slices.Sort(supportedVersions) msgRefuse := NewMsgRefuse( []any{ diff --git a/protocol/versions.go b/protocol/versions.go index 0910f831..0adc882d 100644 --- a/protocol/versions.go +++ b/protocol/versions.go @@ -14,7 +14,7 @@ package protocol -import "sort" +import "slices" // The NtC protocol versions have the 15th bit set in the handshake const ProtocolVersionNtCOffset = 0x8000 @@ -322,9 +322,7 @@ func GetProtocolVersionsNtC() []uint16 { } // sort asending - iterating over map is not deterministic - sort.Slice(versions, func(i, j int) bool { - return versions[i] < versions[j] - }) + slices.Sort(versions) return versions } @@ -339,9 +337,7 @@ func GetProtocolVersionsNtN() []uint16 { } // sort asending - iterating over map is not deterministic - sort.Slice(versions, func(i, j int) bool { - return versions[i] < versions[j] - }) + slices.Sort(versions) return versions }