Files
utxo/sort_helpers.go
zeekayandHanzo Dev 6efa1285f9 lint: clean all 21 staticcheck findings — CI green, drop last codec reference
- SA1019: math.Mul64/Add64 -> generic math.Mul/Add (ed25519fx, mldsafx,
  schnorrfx inputs; flow_checker; utxo_fetching); prefixdb.NewNested -> New (alias)
- unused: DELETE dead codecVersion const (last codec reference in utxo — full
  ZAP native now), isSortedAndUniqueOrdered (root + secp256k1fx), mldsafx
  Keychain.get, and all 6 redundant TransferOutput.isState() markers (the
  embedded verify.IsState already provides State membership)
- QF1008: drop embedded-field selectors (utxo_wire, ed25519fx, nftfx,
  propertyfx + tests); ST1005: lowercase Schnorr error string

Behavior-identical; 11/11 packages pass.

Co-authored-by: Hanzo Dev <dev@hanzo.ai>
2026-07-12 22:32:45 -07:00

24 lines
458 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package utxo
import (
"slices"
)
func sortByCompare[T interface{ Compare(T) int }](s []T) {
slices.SortFunc(s, func(a, b T) int {
return a.Compare(b)
})
}
func isSortedAndUniqueByCompare[T interface{ Compare(T) int }](s []T) bool {
for i := 1; i < len(s); i++ {
if s[i-1].Compare(s[i]) >= 0 {
return false
}
}
return true
}