channeldb/graph: always populate LightningNode features

Previously we would return nil features when we didn't have a node
announcement or a given node. With this change, we can always assume the
feature vector is populated during pathfinding.
This commit is contained in:
Conner Fromknecht 2019-12-18 23:53:05 -08:00
parent 9025a30f5d
commit 80802d8e84
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -3461,6 +3461,10 @@ func deserializeLightningNode(r io.Reader) (LightningNode, error) {
err error
)
// Always populate a feature vector, even if we don't have a node
// announcement and short circuit below.
node.Features = lnwire.EmptyFeatureVector()
if _, err := r.Read(scratch[:]); err != nil {
return LightningNode{}, err
}
@ -3506,12 +3510,10 @@ func deserializeLightningNode(r io.Reader) (LightningNode, error) {
return LightningNode{}, err
}
fv := lnwire.NewFeatureVector(nil, lnwire.Features)
err = fv.Decode(r)
err = node.Features.Decode(r)
if err != nil {
return LightningNode{}, err
}
node.Features = fv
if _, err := r.Read(scratch[:2]); err != nil {
return LightningNode{}, err