Skip to content

Commit 565bc6d

Browse files
committed
tapchannelmsg: add FilterByHtlcIndex helper method to HtlcAssetOutput
1 parent 07b6042 commit 565bc6d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tapchannelmsg/records.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,20 @@ func NewHtlcAssetOutput(
13331333
}
13341334
}
13351335

1336+
// FilterByHtlcIndex returns a slice of AssetOutputs that are associated with
1337+
// the given htlc index.
1338+
func (h *HtlcAssetOutput) FilterByHtlcIndex(id input.HtlcIndex) []*AssetOutput {
1339+
if h.HtlcOutputs == nil {
1340+
return nil
1341+
}
1342+
1343+
if outputs, ok := h.HtlcOutputs[id]; ok {
1344+
return outputs.Outputs
1345+
}
1346+
1347+
return nil
1348+
}
1349+
13361350
// Record creates a Record out of a HtlcAssetOutput using the
13371351
// eHtlcAssetOutput and dHtlcAssetOutput functions.
13381352
//

0 commit comments

Comments
 (0)