swarm/network: bump up protocol versions due to wrapped message intro (#17170)

pull/17174/head
Anton Evangelatov 6 years ago committed by Balint Gabor
parent 7c9314f231
commit d483da766f
  1. 4
      swarm/network/protocol.go
  2. 8
      swarm/network/protocol_test.go
  3. 2
      swarm/network/stream/stream.go

@ -44,7 +44,7 @@ const (
// BzzSpec is the spec of the generic swarm handshake // BzzSpec is the spec of the generic swarm handshake
var BzzSpec = &protocols.Spec{ var BzzSpec = &protocols.Spec{
Name: "bzz", Name: "bzz",
Version: 4, Version: 5,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
HandshakeMsg{}, HandshakeMsg{},
@ -54,7 +54,7 @@ var BzzSpec = &protocols.Spec{
// DiscoverySpec is the spec for the bzz discovery subprotocols // DiscoverySpec is the spec for the bzz discovery subprotocols
var DiscoverySpec = &protocols.Spec{ var DiscoverySpec = &protocols.Spec{
Name: "hive", Name: "hive",
Version: 4, Version: 5,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
peersMsg{}, peersMsg{},

@ -186,7 +186,7 @@ func (s *bzzTester) testHandshake(lhs, rhs *HandshakeMsg, disconnects ...*p2ptes
func correctBzzHandshake(addr *BzzAddr) *HandshakeMsg { func correctBzzHandshake(addr *BzzAddr) *HandshakeMsg {
return &HandshakeMsg{ return &HandshakeMsg{
Version: 4, Version: 5,
NetworkID: DefaultNetworkID, NetworkID: DefaultNetworkID,
Addr: addr, Addr: addr,
} }
@ -199,7 +199,7 @@ func TestBzzHandshakeNetworkIDMismatch(t *testing.T) {
err := s.testHandshake( err := s.testHandshake(
correctBzzHandshake(addr), correctBzzHandshake(addr),
&HandshakeMsg{Version: 4, NetworkID: 321, Addr: NewAddrFromNodeID(id)}, &HandshakeMsg{Version: 5, NetworkID: 321, Addr: NewAddrFromNodeID(id)},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): network id mismatch 321 (!= 3)")}, &p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): network id mismatch 321 (!= 3)")},
) )
@ -216,7 +216,7 @@ func TestBzzHandshakeVersionMismatch(t *testing.T) {
err := s.testHandshake( err := s.testHandshake(
correctBzzHandshake(addr), correctBzzHandshake(addr),
&HandshakeMsg{Version: 0, NetworkID: 3, Addr: NewAddrFromNodeID(id)}, &HandshakeMsg{Version: 0, NetworkID: 3, Addr: NewAddrFromNodeID(id)},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= 4)")}, &p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= 5)")},
) )
if err != nil { if err != nil {
@ -231,7 +231,7 @@ func TestBzzHandshakeSuccess(t *testing.T) {
err := s.testHandshake( err := s.testHandshake(
correctBzzHandshake(addr), correctBzzHandshake(addr),
&HandshakeMsg{Version: 4, NetworkID: 3, Addr: NewAddrFromNodeID(id)}, &HandshakeMsg{Version: 5, NetworkID: 3, Addr: NewAddrFromNodeID(id)},
) )
if err != nil { if err != nil {

@ -653,7 +653,7 @@ func (c *clientParams) clientCreated() {
// Spec is the spec of the streamer protocol // Spec is the spec of the streamer protocol
var Spec = &protocols.Spec{ var Spec = &protocols.Spec{
Name: "stream", Name: "stream",
Version: 4, Version: 5,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
UnsubscribeMsg{}, UnsubscribeMsg{},

Loading…
Cancel
Save