server: Only advertise local addr when current.
This changes the server peers OnVersion handler to only advertise the server as a viable target for inbound connections when the server believes it is close the best known tip. Backported from Decred.
This commit is contained in:
parent
d2c7892aa4
commit
c8b9fab820
1 changed files with 3 additions and 3 deletions
|
@ -453,9 +453,9 @@ func (sp *serverPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) *wire.MsgRej
|
|||
return nil
|
||||
}
|
||||
|
||||
// TODO(davec): Only do this if not doing the initial block
|
||||
// download and the local address is routable.
|
||||
if !cfg.DisableListen /* && isCurrent? */ {
|
||||
// Advertise the local address when the server accepts incoming
|
||||
// connections and it believes itself to be close to the best known tip.
|
||||
if !cfg.DisableListen && sp.server.syncManager.IsCurrent() {
|
||||
// Get address that best matches.
|
||||
lna := addrManager.GetBestLocalAddress(sp.NA())
|
||||
if addrmgr.IsRoutable(lna) {
|
||||
|
|
Loading…
Reference in a new issue