Skip to content

Commit 6066150

Browse files
committed
htlc: add string representation for HtlcOutputType enum
1 parent 87cc557 commit 6066150

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

swap/htlc.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ var (
5050
)
5151
)
5252

53+
// String returns the string value of HtlcOutputType.
54+
func (h HtlcOutputType) String() string {
55+
switch h {
56+
case HtlcP2WSH:
57+
return "P2WSH"
58+
59+
case HtlcNP2WSH:
60+
return "NP2WSH"
61+
62+
default:
63+
return "unknown"
64+
}
65+
}
66+
5367
// NewHtlc returns a new instance.
5468
func NewHtlc(cltvExpiry int32, senderKey, receiverKey [33]byte,
5569
hash lntypes.Hash, outputType HtlcOutputType,

0 commit comments

Comments
 (0)