From 759e532c611910ef2bae8b882d82a6bcb7ffce50 Mon Sep 17 00:00:00 2001 From: carla Date: Thu, 15 Oct 2020 11:29:24 +0200 Subject: [PATCH] accounting: add string function to entry types --- accounting/report.go | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/accounting/report.go b/accounting/report.go index 148f5fa..efcc6b3 100644 --- a/accounting/report.go +++ b/accounting/report.go @@ -1,6 +1,7 @@ package accounting import ( + "fmt" "time" "github.com/lightningnetwork/lnd/lnwire" @@ -165,3 +166,56 @@ const ( // channel. EntryTypeChannelCloseFee ) + +// String returns the string representation of an entry type. +func (e EntryType) String() string { + switch e { + case EntryTypeLocalChannelOpen: + return "local channel open" + + case EntryTypeRemoteChannelOpen: + return "remote channel open" + + case EntryTypeChannelOpenFee: + return "channel open fee" + + case EntryTypeChannelClose: + return "channel close fee" + + case EntryTypeReceipt: + return "receipt" + + case EntryTypePayment: + return "payment" + + case EntryTypeFee: + return "fee" + + case EntryTypeCircularReceipt: + return "circular payment receipt" + + case EntryTypeForward: + return "forward" + + case EntryTypeForwardFee: + return "forward fee" + + case EntryTypeCircularPayment: + return "circular payment" + + case EntryTypeCircularPaymentFee: + return "circular payment fee" + + case EntryTypeSweep: + return "sweep" + + case EntryTypeSweepFee: + return "sweep fee" + + case EntryTypeChannelCloseFee: + return "channel close fee" + + default: + return fmt.Sprintf("unknown: %d", e) + } +}