Skip to content

Commit 14e3719

Browse files
committed
lnwallet: remove unnecessary duplicate definition
1 parent c262b1b commit 14e3719

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

lnwallet/channel.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,23 +349,13 @@ type commitment struct {
349349

350350
// locateOutputIndex is a small helper function to locate the output index of a
351351
// particular HTLC within the current commitment transaction. The duplicate map
352-
// massed in is to be retained for each output within the commitment
352+
// passed in is to be retained for each output within the commitment
353353
// transition. This ensures that we don't assign multiple HTLCs to the same
354354
// index within the commitment transaction.
355355
func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx,
356356
whoseCommit lntypes.ChannelParty, dups map[PaymentHash][]int32,
357357
cltvs []uint32) (int32, error) {
358358

359-
// Checks to see if element (e) exists in slice (s).
360-
contains := func(s []int32, e int32) bool {
361-
for _, a := range s {
362-
if a == e {
363-
return true
364-
}
365-
}
366-
return false
367-
}
368-
369359
// If this is their commitment transaction, we'll be trying to locate
370360
// their pkScripts, otherwise we'll be looking for ours. This is
371361
// required as the commitment states are asymmetric in order to ascribe
@@ -385,7 +375,7 @@ func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx,
385375
// If this payment hash and index has already been
386376
// found, then we'll continue in order to avoid any
387377
// duplicate indexes.
388-
if contains(dups[p.RHash], int32(i)) {
378+
if fn.Elem(int32(i), dups[p.RHash]) {
389379
continue
390380
}
391381

0 commit comments

Comments
 (0)