From d9eef4625e392de4a14800f6da3038329837a855 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 10 Dec 2018 14:56:54 +0100 Subject: [PATCH] autopilot/prefattach: populate Addrs field --- autopilot/prefattach.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autopilot/prefattach.go b/autopilot/prefattach.go index d90437b89..32bd2fcc5 100644 --- a/autopilot/prefattach.go +++ b/autopilot/prefattach.go @@ -148,6 +148,7 @@ func (p *ConstrainedPrefAttachment) NodeScores(g ChannelGraph, chans []Channel, } _, ok := existingPeers[nID] + addrs := addresses[nID] switch { @@ -160,6 +161,11 @@ func (p *ConstrainedPrefAttachment) NodeScores(g ChannelGraph, chans []Channel, // another channel. case chanSize == 0 || chanSize < p.constraints.MinChanSize: continue + + // If the node has no addresses, we cannot connect to it, so we + // skip it for now, which implicitly gives it a score of 0. + case len(addrs) == 0: + continue } // Otherwise we score the node according to its fraction of @@ -168,6 +174,7 @@ func (p *ConstrainedPrefAttachment) NodeScores(g ChannelGraph, chans []Channel, candidates[nID] = &AttachmentDirective{ NodeID: nID, ChanAmt: chanSize, + Addrs: addrs, Score: score, } }