Update for recent btcwire AddUserAgent addition.

This commit is contained in:
Dave Collins 2014-04-20 14:15:01 -05:00
parent 88093cb838
commit 1e75ccc9b9

17
peer.go
View file

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