autopilot/prefattach: populate Addrs field

This commit is contained in:
Johan T. Halseth committed 2018-12-10 15:00:41 +01:00
1 parent 55ba5fe654
commit d9eef4625e
1 file changed
+7
+7
View File
@@ -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,
}
}