From a3d783e9e872b508cdddc7f02a2a932986558c6c Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Thu, 28 Nov 2013 17:04:56 +0000 Subject: [PATCH] set up p.na before preparing our reply version message. Means we can use that instead of generating another (next commit). --- peer.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/peer.go b/peer.go index aa9439e9..4e3b8bf6 100644 --- a/peer.go +++ b/peer.go @@ -254,14 +254,6 @@ func (p *peer) handleVersionMsg(msg *btcwire.MsgVersion) { // Inbound connections. 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. // We only do this inbound because outbound set this up // at connection time and no point recomputing. @@ -272,6 +264,14 @@ func (p *peer) handleVersionMsg(msg *btcwire.MsgVersion) { return } 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.