swarm: Fix bzz initialization from tests

This commit is contained in:
Balint Gabor 2018-03-05 18:16:46 +01:00
parent 79abcac95e
commit 86df48a2a1
6 changed files with 11 additions and 8 deletions

View file

@ -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

View file

@ -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)

View file

@ -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
}

View file

@ -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 {

View file

@ -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
},
}
}

View file

@ -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
},
}
}