channeldb: take serialized key to fetch lightning node

This prevents inefficient key conversions in a follow up commit that
change the inner pathfinding loop.
This commit is contained in:
Joost Jager
2019-12-18 12:43:18 +01:00
parent 8ce9e15f4a
commit 37d9ee302c
9 changed files with 39 additions and 61 deletions

View File

@ -7,7 +7,6 @@ import (
"math"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/coreos/bbolt"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/feature"
@ -447,12 +446,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
// we have for the target node from our graph.
features := r.DestFeatures
if features == nil {
targetKey, err := btcec.ParsePubKey(target[:], btcec.S256())
if err != nil {
return nil, err
}
targetNode, err := g.graph.FetchLightningNode(targetKey)
targetNode, err := g.graph.FetchLightningNode(target)
switch {
// If the node exists and has features, use them directly.