Skip to content

Commit 3a3571b

Browse files
committed
labels: add on-chain labels for loop in/out
1 parent afc41ad commit 3a3571b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

labels/lnd_labels.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package labels
2+
3+
import "fmt"
4+
5+
const (
6+
// loopdLabelPattern is the pattern that loop uses to label on-chain
7+
// transactions in the lnd backend.
8+
loopdLabelPattern = "loopd -- %s(swap=%s)"
9+
10+
// loopOutSweepSuccess is the label used for loop out swaps to sweep
11+
// the HTLC in the success case.
12+
loopOutSweepSuccess = "OutSweepSuccess"
13+
14+
// loopInHtlc is the label used for loop in swaps to publish an HTLC.
15+
loopInHtlc = "InHtlc"
16+
17+
// loopInTimeout is the label used for loop in swaps to sweep an HTLC
18+
// that has timed out.
19+
loopInSweepTimeout = "InSweepTimeout"
20+
)
21+
22+
// LoopOutSweepSuccess returns the label used for loop out swaps to sweep the
23+
// HTLC in the success case.
24+
func LoopOutSweepSuccess(swapHash string) string {
25+
return fmt.Sprintf(loopdLabelPattern, loopOutSweepSuccess, swapHash)
26+
}
27+
28+
// LoopInHtlcLabel returns the label used for loop in swaps to publish an HTLC.
29+
func LoopInHtlcLabel(swapHash string) string {
30+
return fmt.Sprintf(loopdLabelPattern, loopInHtlc, swapHash)
31+
}
32+
33+
// LoopInSweepTimeout returns the label used for loop in swaps to sweep an HTLC
34+
// that has timed out.
35+
func LoopInSweepTimeout(swapHash string) string {
36+
return fmt.Sprintf(loopdLabelPattern, loopInSweepTimeout, swapHash)
37+
}

0 commit comments

Comments
 (0)