chore: use slices.Contains for linear search
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:
parent
5df40c1de1
commit
6324e5f3ca
1 changed files with 3 additions and 7 deletions
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue