mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-21 06:12:38 +02:00
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 (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
|
||||||
"github.com/go-errors/errors"
|
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"github.com/go-errors/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// featureFlag represent the status of the feature optional/required and needed
|
// featureFlag represent the status of the feature optional/required and needed
|
||||||
// to allow future incompatible changes, or backward compatible changes.
|
// to allow future incompatible changes, or backward compatible changes.
|
||||||
type featureFlag uint8
|
type featureFlag uint8
|
||||||
|
|
||||||
|
// String returns the string representation for the featureFlag.
|
||||||
func (f featureFlag) String() string {
|
func (f featureFlag) String() string {
|
||||||
switch f {
|
switch f {
|
||||||
case OptionalFlag:
|
case OptionalFlag:
|
||||||
@ -114,22 +115,6 @@ func (f *FeatureVector) serializedSize() uint16 {
|
|||||||
return uint16(math.Ceil(float64(flagBitsSize*len(f.flags)) / 8))
|
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
|
// NewFeatureVectorFromReader decodes the feature vector from binary
|
||||||
// representation and creates the instance of it.
|
// representation and creates the instance of it.
|
||||||
// Every feature decoded as 2 bits where odd bit determine whether the feature
|
// Every feature decoded as 2 bits where odd bit determine whether the feature
|
||||||
|
Loading…
x
Reference in New Issue
Block a user