autopilot/prefattach: populate Addrs field

This commit is contained in:
Johan T. Halseth 2018-12-10 14:56:54 +01:00
parent 55ba5fe654
commit d9eef4625e
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -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,
}
}