chore: use slices.Contains for linear search
Some checks failed
Security Scan / security (pull_request) Successful in 12s
Test / Test (pull_request) Failing after 35s

Replace manual loop-and-break index search with slices.IndexFunc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude 2026-02-24 16:19:31 +00:00
parent 5df40c1de1
commit 6324e5f3ca
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -164,13 +164,9 @@ func (b *V1Builder) buildInput(src *Transfer) (types.TxInputToKey, inputMeta, er
})
// Find real index after sorting.
realIdx := -1
for j, m := range ring {
if m.GlobalIndex == src.GlobalIndex {
realIdx = j
break
}
}
realIdx := slices.IndexFunc(ring, func(m RingMember) bool {
return m.GlobalIndex == src.GlobalIndex
})
if realIdx < 0 {
return types.TxInputToKey{}, inputMeta{}, errors.New("real output not found in ring")
}