peer: Stop setting AddrMe in the version message.
Older nodes previously added the IP and port information to the address manager which proved to be unreliable as an inbound connection from a peer didn't necessarily mean the peer itself accepted inbound connections. This also fixes a bug where the peer package was incorrectly sending the peer's services as its own.
This commit is contained in:
parent
bca9877796
commit
a09d052f96
1 changed files with 11 additions and 5 deletions
16
peer/peer.go
16
peer/peer.go
|
@ -784,11 +784,17 @@ func (p *Peer) localVersionMsg() (*wire.MsgVersion, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(tuxcanfly): In case BestLocalAddress is nil, ourNA defaults to
|
// Create a wire.NetAddress with only the services set to use as the
|
||||||
// remote NA, which is wrong. Need to fix this.
|
// "addrme" in the version message.
|
||||||
ourNA := p.na
|
//
|
||||||
if p.cfg.BestLocalAddress != nil {
|
// Older nodes previously added the IP and port information to the
|
||||||
ourNA = p.cfg.BestLocalAddress(p.na)
|
// address manager which proved to be unreliable as an inbound
|
||||||
|
// connection from a peer didn't necessarily mean the peer itself
|
||||||
|
// accepted inbound connections.
|
||||||
|
//
|
||||||
|
// Also, the timestamp is unused in the version message.
|
||||||
|
ourNA := &wire.NetAddress{
|
||||||
|
Services: p.cfg.Services,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a unique nonce for this peer so self connections can be
|
// Generate a unique nonce for this peer so self connections can be
|
||||||
|
|
Loading…
Add table
Reference in a new issue