From f9b44567ed1cd3978205469eb4ce868b6c3c89eb Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 22 Feb 2017 15:53:12 -0800 Subject: [PATCH] lnwire: remove String() method from FeatureVector This commit removes the String() method from the FeatureVector as it can produce confusing output when revving a feature vector and not knowing the strip mapping ahead of time. --- lnwire/features.go | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lnwire/features.go b/lnwire/features.go index fbaa72ec2..1edaac198 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -2,16 +2,17 @@ package lnwire import ( "encoding/binary" - "fmt" - "github.com/go-errors/errors" "io" "math" + + "github.com/go-errors/errors" ) // featureFlag represent the status of the feature optional/required and needed // to allow future incompatible changes, or backward compatible changes. type featureFlag uint8 +// String returns the string representation for the featureFlag. func (f featureFlag) String() string { switch f { case OptionalFlag: @@ -114,22 +115,6 @@ func (f *FeatureVector) serializedSize() uint16 { return uint16(math.Ceil(float64(flagBitsSize*len(f.flags)) / 8)) } -// String returns the feature vector description. -func (f *FeatureVector) String() string { - var description string - for name, index := range f.featuresMap { - if flag, ok := f.flags[index]; ok { - description += fmt.Sprintf("%s: %s\n", name, flag) - } - } - - if description == "" { - description = "" - } - - return "\n" + description -} - // NewFeatureVectorFromReader decodes the feature vector from binary // representation and creates the instance of it. // Every feature decoded as 2 bits where odd bit determine whether the feature