mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network: Simplify bucket instantiation in servicectx func
This commit is contained in:
parent
19b0bd5b44
commit
a9c44e0b85
1 changed files with 2 additions and 3 deletions
|
|
@ -85,9 +85,8 @@ func New(services map[string]ServiceFunc) (s *Simulation) {
|
|||
name, serviceFunc := name, serviceFunc
|
||||
s.serviceNames = append(s.serviceNames, name)
|
||||
adapterServices[name] = func(ctx *adapters.ServiceContext) (node.Service, error) {
|
||||
var b *sync.Map
|
||||
var ok bool
|
||||
if b, ok = s.buckets[ctx.Config.ID]; !ok {
|
||||
b, ok := s.buckets[ctx.Config.ID]
|
||||
if !ok {
|
||||
b = new(sync.Map)
|
||||
}
|
||||
service, cleanup, err := serviceFunc(ctx, b)
|
||||
|
|
|
|||
Loading…
Reference in a new issue