lnwallet: remove unnecessary duplicate definition
This commit is contained in:
1 file changed
+2
-12
+2
-12
@@ -349,23 +349,13 @@ type commitment struct {
|
|||||||
|
|
||||||
// locateOutputIndex is a small helper function to locate the output index of a
|
// locateOutputIndex is a small helper function to locate the output index of a
|
||||||
// particular HTLC within the current commitment transaction. The duplicate map
|
// particular HTLC within the current commitment transaction. The duplicate map
|
||||||
// massed in is to be retained for each output within the commitment
|
// passed in is to be retained for each output within the commitment
|
||||||
// transition. This ensures that we don't assign multiple HTLCs to the same
|
// transition. This ensures that we don't assign multiple HTLCs to the same
|
||||||
// index within the commitment transaction.
|
// index within the commitment transaction.
|
||||||
func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx,
|
func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx,
|
||||||
whoseCommit lntypes.ChannelParty, dups map[PaymentHash][]int32,
|
whoseCommit lntypes.ChannelParty, dups map[PaymentHash][]int32,
|
||||||
cltvs []uint32) (int32, error) {
|
cltvs []uint32) (int32, error) {
|
||||||
|
|
||||||
// Checks to see if element (e) exists in slice (s).
|
|
||||||
contains := func(s []int32, e int32) bool {
|
|
||||||
for _, a := range s {
|
|
||||||
if a == e {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this is their commitment transaction, we'll be trying to locate
|
// If this is their commitment transaction, we'll be trying to locate
|
||||||
// their pkScripts, otherwise we'll be looking for ours. This is
|
// their pkScripts, otherwise we'll be looking for ours. This is
|
||||||
// required as the commitment states are asymmetric in order to ascribe
|
// required as the commitment states are asymmetric in order to ascribe
|
||||||
@@ -385,7 +375,7 @@ func locateOutputIndex(p *PaymentDescriptor, tx *wire.MsgTx,
|
|||||||
// If this payment hash and index has already been
|
// If this payment hash and index has already been
|
||||||
// found, then we'll continue in order to avoid any
|
// found, then we'll continue in order to avoid any
|
||||||
// duplicate indexes.
|
// duplicate indexes.
|
||||||
if contains(dups[p.RHash], int32(i)) {
|
if fn.Elem(int32(i), dups[p.RHash]) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user