From 60661504a5acef513ab9f829b840b98878d53d48 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Thu, 30 Apr 2020 15:37:01 +0200 Subject: [PATCH] htlc: add string representation for HtlcOutputType enum --- swap/htlc.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/swap/htlc.go b/swap/htlc.go index 539a187..c207b3d 100644 --- a/swap/htlc.go +++ b/swap/htlc.go @@ -50,6 +50,20 @@ var ( ) ) +// String returns the string value of HtlcOutputType. +func (h HtlcOutputType) String() string { + switch h { + case HtlcP2WSH: + return "P2WSH" + + case HtlcNP2WSH: + return "NP2WSH" + + default: + return "unknown" + } +} + // NewHtlc returns a new instance. func NewHtlc(cltvExpiry int32, senderKey, receiverKey [33]byte, hash lntypes.Hash, outputType HtlcOutputType,