mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-608] Make the user agent read the version from the version package. (#566)
This commit is contained in:
parent
ebf635e6ff
commit
df91643976
@ -241,8 +241,8 @@ func TestPeerConnection(t *testing.T) {
|
||||
wantLastPingNonce: uint64(0),
|
||||
wantLastPingMicros: int64(0),
|
||||
wantTimeOffset: int64(0),
|
||||
wantBytesSent: 198, // 174 version + 24 verack
|
||||
wantBytesReceived: 198,
|
||||
wantBytesSent: 201, // 177 version + 24 verack
|
||||
wantBytesReceived: 201,
|
||||
}
|
||||
wantStats2 := peerStats{
|
||||
wantUserAgent: wire.DefaultUserAgent + "peer:1.0(comment)/",
|
||||
@ -255,8 +255,8 @@ func TestPeerConnection(t *testing.T) {
|
||||
wantLastPingNonce: uint64(0),
|
||||
wantLastPingMicros: int64(0),
|
||||
wantTimeOffset: int64(0),
|
||||
wantBytesSent: 198, // 174 version + 24 verack
|
||||
wantBytesReceived: 198,
|
||||
wantBytesSent: 201, // 177 version + 24 verack
|
||||
wantBytesReceived: 201,
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
|
@ -79,7 +79,7 @@ func TestMessage(t *testing.T) {
|
||||
kaspaNet KaspaNet // Network to use for wire encoding
|
||||
bytes int // Expected num bytes read/written
|
||||
}{
|
||||
{msgVersion, msgVersion, pver, MainNet, 156},
|
||||
{msgVersion, msgVersion, pver, MainNet, 159},
|
||||
{msgVerack, msgVerack, pver, MainNet, 24},
|
||||
{msgGetAddr, msgGetAddr, pver, MainNet, 26},
|
||||
{msgAddr, msgAddr, pver, MainNet, 27},
|
||||
|
@ -7,6 +7,7 @@ package wire
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/kaspanet/kaspad/version"
|
||||
"github.com/pkg/errors"
|
||||
"io"
|
||||
"strings"
|
||||
@ -21,7 +22,7 @@ import (
|
||||
const MaxUserAgentLen = 256
|
||||
|
||||
// DefaultUserAgent for wire in the stack
|
||||
const DefaultUserAgent = "/kaspawire:0.1.0/"
|
||||
var DefaultUserAgent = fmt.Sprintf("/kaspad:%s/", version.Version())
|
||||
|
||||
// MsgVersion implements the Message interface and represents a kaspa version
|
||||
// message. It is used for a peer to advertise itself as soon as an outbound
|
||||
|
Loading…
x
Reference in New Issue
Block a user