Merge pull request #997 from nspcc-dev/neo3/protocol/fix

network: remove outdated fields
This commit is contained in:
Roman Khimov 2020-05-27 19:41:43 +03:00 committed by GitHub
commit ad74cd7273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/core/block"
"github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/core/transaction"
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes" "github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
"github.com/nspcc-dev/neo-go/pkg/network/capability"
"github.com/nspcc-dev/neo-go/pkg/network/payload" "github.com/nspcc-dev/neo-go/pkg/network/payload"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -15,15 +16,19 @@ import (
func TestEncodeDecodeVersion(t *testing.T) { func TestEncodeDecodeVersion(t *testing.T) {
// message with tiny payload, shouldn't be compressed // message with tiny payload, shouldn't be compressed
expected := NewMessage(CMDVersion, &payload.Version{ expected := NewMessage(CMDVersion, &payload.Version{
Magic: 1, Magic: 1,
Version: 2, Version: 2,
Services: 1, Timestamp: uint32(time.Now().UnixNano()),
Timestamp: uint32(time.Now().UnixNano()), Nonce: 987,
Port: 1234, UserAgent: []byte{1, 2, 3},
Nonce: 987, Capabilities: capability.Capabilities{
UserAgent: []byte{1, 2, 3}, {
StartHeight: 123, Type: capability.FullNode,
Relay: true, Data: &capability.Node{
StartHeight: 123,
},
},
},
}) })
testserdes.EncodeDecode(t, expected, &Message{}) testserdes.EncodeDecode(t, expected, &Message{})
uncompressed, err := testserdes.EncodeBinary(expected.Payload) uncompressed, err := testserdes.EncodeBinary(expected.Payload)