Merge pull request #437 from ethersphere/bump-protocol-versions

swarm/network: bump versions for protocols bzz, hive and stream to 3
This commit is contained in:
Anton Evangelatov 2018-04-26 14:53:35 +02:00 committed by GitHub
commit a50bf69d91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View file

@ -59,7 +59,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: 1, Version: 3,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
HandshakeMsg{}, HandshakeMsg{},
@ -69,7 +69,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: 1, Version: 3,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
peersMsg{}, peersMsg{},
@ -188,7 +188,7 @@ func (b *Bzz) Protocols() []p2p.Protocol {
func (b *Bzz) APIs() []rpc.API { func (b *Bzz) APIs() []rpc.API {
return []rpc.API{{ return []rpc.API{{
Namespace: "hive", Namespace: "hive",
Version: "1.0", Version: "3.0",
Service: b.Hive, Service: b.Hive,
}} }}
} }

View file

@ -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: 1, Version: 3,
NetworkID: 322, NetworkID: 322,
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: 1, NetworkID: 321, Addr: NewAddrFromNodeID(id)}, &HandshakeMsg{Version: 3, NetworkID: 321, Addr: NewAddrFromNodeID(id)},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): network id mismatch 321 (!= 322)")}, &p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): network id mismatch 321 (!= 322)")},
) )
@ -216,7 +216,7 @@ func TestBzzHandshakeVersionMismatch(t *testing.T) {
err := s.testHandshake( err := s.testHandshake(
correctBzzHandshake(addr), correctBzzHandshake(addr),
&HandshakeMsg{Version: 0, NetworkID: 322, Addr: NewAddrFromNodeID(id)}, &HandshakeMsg{Version: 0, NetworkID: 322, Addr: NewAddrFromNodeID(id)},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= 1)")}, &p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= 3)")},
) )
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: 1, NetworkID: 322, Addr: NewAddrFromNodeID(id)}, &HandshakeMsg{Version: 3, NetworkID: 322, Addr: NewAddrFromNodeID(id)},
) )
if err != nil { if err != nil {

View file

@ -221,7 +221,7 @@ func (r *TestRegistry) APIs() []rpc.API {
a := r.Registry.APIs() a := r.Registry.APIs()
a = append(a, rpc.API{ a = append(a, rpc.API{
Namespace: "stream", Namespace: "stream",
Version: "0.1", Version: "3.0",
Service: r, Service: r,
Public: true, Public: true,
}) })
@ -264,7 +264,7 @@ func (r *TestExternalRegistry) APIs() []rpc.API {
a := r.Registry.APIs() a := r.Registry.APIs()
a = append(a, rpc.API{ a = append(a, rpc.API{
Namespace: "stream", Namespace: "stream",
Version: "0.1", Version: "3.0",
Service: r, Service: r,
Public: true, Public: true,
}) })

View file

@ -642,7 +642,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: 1, Version: 3,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
UnsubscribeMsg{}, UnsubscribeMsg{},
@ -675,7 +675,7 @@ func (r *Registry) APIs() []rpc.API {
return []rpc.API{ return []rpc.API{
{ {
Namespace: "stream", Namespace: "stream",
Version: "0.1", Version: "3.0",
Service: r.api, Service: r.api,
Public: true, Public: true,
}, },

View file

@ -468,14 +468,14 @@ func (self *Swarm) APIs() []rpc.API {
// public APIs // public APIs
{ {
Namespace: "bzz", Namespace: "bzz",
Version: "0.1", Version: "3.0",
Service: &Info{self.config, chequebook.ContractParams}, Service: &Info{self.config, chequebook.ContractParams},
Public: true, Public: true,
}, },
// admin APIs // admin APIs
{ {
Namespace: "bzz", Namespace: "bzz",
Version: "0.1", Version: "3.0",
Service: api.NewControl(self.api, self.bzz.Hive), Service: api.NewControl(self.api, self.bzz.Hive),
Public: false, Public: false,
}, },