set up p.na before preparing our reply version message.

Means we can use that instead of generating another (next commit).
This commit is contained in:
Owain G. Ainsworth 2013-11-28 17:04:56 +00:00
parent c8e88d383e
commit a3d783e9e8

16
peer.go
View file

@ -254,14 +254,6 @@ func (p *peer) handleVersionMsg(msg *btcwire.MsgVersion) {
// Inbound connections. // Inbound connections.
if p.inbound { if p.inbound {
// Send version.
err := p.pushVersionMsg()
if err != nil {
p.logError("Can't send version message: %v", err)
p.Disconnect()
return
}
// Set up a NetAddress for the peer to be used with AddrManager. // Set up a NetAddress for the peer to be used with AddrManager.
// We only do this inbound because outbound set this up // We only do this inbound because outbound set this up
// at connection time and no point recomputing. // at connection time and no point recomputing.
@ -272,6 +264,14 @@ func (p *peer) handleVersionMsg(msg *btcwire.MsgVersion) {
return return
} }
p.na = na p.na = na
// Send version.
err = p.pushVersionMsg()
if err != nil {
p.logError("Can't send version message: %v", err)
p.Disconnect()
return
}
} }
// Send verack. // Send verack.