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.
This commit is contained in:
parent
ace1adb13f
commit
f9b44567ed
@ -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 = "<empty>"
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user