From f34239889bca734adee86992f8e6dbf80ba1ceab Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 10 Dec 2019 13:08:59 -0800 Subject: [PATCH] lnwire/feature: remove feature bit number from name The number and the name will be separate on the rpc level, so we remove the feature bit from the string. Currently this method is unused apart from maybe in some rare logging instances. --- lnwire/features.go | 5 ++--- lnwire/features_test.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lnwire/features.go b/lnwire/features.go index 5d96c87e..f41ae607 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -3,7 +3,6 @@ package lnwire import ( "encoding/binary" "errors" - "fmt" "io" ) @@ -362,9 +361,9 @@ func (fv *FeatureVector) UnknownRequiredFeatures() []FeatureBit { func (fv *FeatureVector) Name(bit FeatureBit) string { name, known := fv.featureNames[bit] if !known { - name = "unknown" + return "unknown" } - return fmt.Sprintf("%s(%d)", name, bit) + return name } // IsKnown returns whether this feature bit represents a known feature. diff --git a/lnwire/features_test.go b/lnwire/features_test.go index 6a80bb83..cff76ec1 100644 --- a/lnwire/features_test.go +++ b/lnwire/features_test.go @@ -205,42 +205,42 @@ func TestFeatureNames(t *testing.T) { }{ { bit: 0, - expectedName: "feature1(0)", + expectedName: "feature1", expectedKnown: true, }, { bit: 1, - expectedName: "unknown(1)", + expectedName: "unknown", expectedKnown: false, }, { bit: 2, - expectedName: "unknown(2)", + expectedName: "unknown", expectedKnown: false, }, { bit: 3, - expectedName: "feature2(3)", + expectedName: "feature2", expectedKnown: true, }, { bit: 4, - expectedName: "feature3(4)", + expectedName: "feature3", expectedKnown: true, }, { bit: 5, - expectedName: "feature3(5)", + expectedName: "feature3", expectedKnown: true, }, { bit: 6, - expectedName: "unknown(6)", + expectedName: "unknown", expectedKnown: false, }, { bit: 7, - expectedName: "unknown(7)", + expectedName: "unknown", expectedKnown: false, }, }