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:
parent
c8e88d383e
commit
a3d783e9e8
1 changed files with 8 additions and 8 deletions
16
peer.go
16
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.
|
||||
|
|
Loading…
Reference in a new issue