diff --git a/swarm/network/protocol.go b/swarm/network/protocol.go index 325b49bfd3..d90ba22f30 100644 --- a/swarm/network/protocol.go +++ b/swarm/network/protocol.go @@ -154,7 +154,7 @@ func (b *Bzz) NodeInfo() interface{} { // * handshake/hive // * discovery func (b *Bzz) Protocols() []p2p.Protocol { - return []p2p.Protocol{ + protocol := []p2p.Protocol{ { Name: BzzSpec.Name, Version: BzzSpec.Version, @@ -170,13 +170,16 @@ func (b *Bzz) Protocols() []p2p.Protocol { NodeInfo: b.Hive.NodeInfo, PeerInfo: b.Hive.PeerInfo, }, - { + } + if b.streamerSpec != nil && b.streamerRun != nil { + protocol = append(protocol, p2p.Protocol{ Name: b.streamerSpec.Name, Version: b.streamerSpec.Version, Length: b.streamerSpec.Length(), Run: b.RunProtocol(b.streamerSpec, b.streamerRun), - }, + }) } + return protocol } // APIs returns the APIs offered by bzz diff --git a/swarm/network/protocol_test.go b/swarm/network/protocol_test.go index 19bc9bea7c..c9a8da1dd1 100644 --- a/swarm/network/protocol_test.go +++ b/swarm/network/protocol_test.go @@ -137,7 +137,7 @@ func newBzzHandshakeTester(t *testing.T, n int, addr *BzzAddr) *bzzTester { HiveParams: NewHiveParams(), } kad := NewKademlia(addr.OAddr, NewKadParams()) - bzz := NewBzz(config, kad, nil) + bzz := NewBzz(config, kad, nil, nil, nil) s := p2ptest.NewProtocolTester(t, NewNodeIDFromAddr(addr), 1, bzz.runBzz) diff --git a/swarm/network/simulations/discovery/discovery_test.go b/swarm/network/simulations/discovery/discovery_test.go index 66f69794bf..5a29028f47 100644 --- a/swarm/network/simulations/discovery/discovery_test.go +++ b/swarm/network/simulations/discovery/discovery_test.go @@ -331,5 +331,5 @@ func newService(ctx *adapters.ServiceContext) (node.Service, error) { HiveParams: hp, } - return network.NewBzz(config, kad, nil), nil + return network.NewBzz(config, kad, nil, nil, nil), nil } diff --git a/swarm/network/simulations/overlay.go b/swarm/network/simulations/overlay.go index f69813e755..a82b1cd100 100644 --- a/swarm/network/simulations/overlay.go +++ b/swarm/network/simulations/overlay.go @@ -69,7 +69,7 @@ func (s *Simulation) NewService(ctx *adapters.ServiceContext) (node.Service, err HiveParams: hp, } - return network.NewBzz(config, kad, store), nil + return network.NewBzz(config, kad, store, nil, nil), nil } func createMockers() map[string]*simulations.MockerConfig { diff --git a/swarm/pss/client/client_test.go b/swarm/pss/client/client_test.go index 9ce4e856a8..10f0171197 100644 --- a/swarm/pss/client/client_test.go +++ b/swarm/pss/client/client_test.go @@ -263,7 +263,7 @@ func newServices() adapters.Services { UnderlayAddr: addr.Under(), HiveParams: hp, } - return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore), nil + return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore, nil, nil), nil }, } } diff --git a/swarm/pss/pss_test.go b/swarm/pss/pss_test.go index 190d704f59..e26a7e600a 100644 --- a/swarm/pss/pss_test.go +++ b/swarm/pss/pss_test.go @@ -1192,7 +1192,7 @@ func newServices() adapters.Services { UnderlayAddr: addr.Under(), HiveParams: hp, } - return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore), nil + return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore, nil, nil), nil }, } }