From 6324e5f3ca3edf3f43f624a4fba08dfd003c1825 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 16:19:31 +0000 Subject: [PATCH] chore: use slices.Contains for linear search Replace manual loop-and-break index search with slices.IndexFunc. Co-Authored-By: Claude Opus 4.6 --- wallet/builder.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/wallet/builder.go b/wallet/builder.go index ef05301..52532a7 100644 --- a/wallet/builder.go +++ b/wallet/builder.go @@ -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") }