From 1e75ccc9b999f9a84fbca1e9d281dde2f357eeba Mon Sep 17 00:00:00 2001
From: Dave Collins <davec@conformal.com>
Date: Sun, 20 Apr 2014 14:15:01 -0500
Subject: [PATCH] Update for recent btcwire AddUserAgent addition.

---
 peer.go | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/peer.go b/peer.go
index b9754d957..6d27cd5a0 100644
--- a/peer.go
+++ b/peer.go
@@ -50,9 +50,15 @@ const (
 	pingTimeoutMinutes = 2
 )
 
-// userAgent is the user agent string used to identify ourselves to other
-// bitcoin peers.
-var userAgent = fmt.Sprintf("/btcd:%d.%d.%d/", appMajor, appMinor, appPatch)
+var (
+	// userAgentName is the user agent name and is used to help identify
+	// ourselves to other bitcoin peers.
+	userAgentName = "btcd"
+
+	// userAgentVersion is the user agent version and is used to help
+	// identify ourselves to other bitcoin peers.
+	userAgentVersion = fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
+)
 
 // zeroHash is the zero value hash (all zeros).  It is defined as a convenience.
 var zeroHash btcwire.ShaHash
@@ -238,8 +244,9 @@ func (p *peer) pushVersionMsg() error {
 
 	// Version message.
 	msg := btcwire.NewMsgVersion(
-		p.server.addrManager.getBestLocalAddress(p.na), theirNa, p.server.nonce,
-		userAgent, int32(blockNum))
+		p.server.addrManager.getBestLocalAddress(p.na), theirNa,
+		p.server.nonce, int32(blockNum))
+	msg.AddUserAgent(userAgentName, userAgentVersion)
 
 	// XXX: bitcoind appears to always enable the full node services flag
 	// of the remote peer netaddress field in the version message regardless