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

@@ -3369,7 +3369,12 @@ func computeNextBackoff(currBackoff time.Duration) time.Duration {
// fetchNodeAdvertisedAddr attempts to fetch an advertised address of a node.
func (s *server) fetchNodeAdvertisedAddr(pub *btcec.PublicKey) (net.Addr, error) {
node, err := s.chanDB.ChannelGraph().FetchLightningNode(pub)
vertex, err := route.NewVertexFromBytes(pub.SerializeCompressed())
if err != nil {
return nil, err
}
node, err := s.chanDB.ChannelGraph().FetchLightningNode(vertex)
if err != nil {
return nil, err
}