swarm/pss: bugfix

This commit is contained in:
Vlad 2019-03-21 20:45:55 +04:00
parent 8badaa55ca
commit b04836cb9f
2 changed files with 3 additions and 3 deletions

View file

@ -25,7 +25,6 @@ import (
"os" "os"
"time" "time"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/simulations" "github.com/ethereum/go-ethereum/p2p/simulations"
"github.com/ethereum/go-ethereum/p2p/simulations/adapters" "github.com/ethereum/go-ethereum/p2p/simulations/adapters"

View file

@ -213,7 +213,7 @@ func testProxNetwork(t *testing.T) {
services := newProxServices(tstdata, true, handlerContextFuncs, tstdata.kademlias) services := newProxServices(tstdata, true, handlerContextFuncs, tstdata.kademlias)
tstdata.sim = simulation.New(services) tstdata.sim = simulation.New(services)
defer tstdata.sim.Close() defer tstdata.sim.Close()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*120) ctx, cancel := context.WithTimeout(context.Background(), 180*time.Second)
defer cancel() defer cancel()
filename := fmt.Sprintf("testdata/snapshot_%d.json", nodeCount) filename := fmt.Sprintf("testdata/snapshot_%d.json", nodeCount)
err := tstdata.sim.UploadSnapshot(ctx, filename) err := tstdata.sim.UploadSnapshot(ctx, filename)
@ -400,7 +400,6 @@ func newProxServices(tstdata *testData, allowRaw bool, handlerContextFuncs map[T
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
b.Store(simulation.BucketKeyKademlia, pskad)
// register the handlers we've been passed // register the handlers we've been passed
var deregisters []func() var deregisters []func()
@ -422,6 +421,8 @@ func newProxServices(tstdata *testData, allowRaw bool, handlerContextFuncs map[T
Public: false, Public: false,
}) })
b.Store(simulation.BucketKeyKademlia, pskad)
// return Pss and cleanups // return Pss and cleanups
return ps, func() { return ps, func() {
// run the handler deregister functions in reverse order // run the handler deregister functions in reverse order