diff options
Diffstat (limited to 'swarm/storage/feed/testutil.go')
-rw-r--r-- | swarm/storage/feed/testutil.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/swarm/storage/feed/testutil.go b/swarm/storage/feed/testutil.go index caa39d9ff..db2d989e1 100644 --- a/swarm/storage/feed/testutil.go +++ b/swarm/storage/feed/testutil.go @@ -18,12 +18,13 @@ package feed import ( "context" - "fmt" "path/filepath" "sync" "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/ethereum/go-ethereum/swarm/chunk" "github.com/ethereum/go-ethereum/swarm/storage" + "github.com/ethereum/go-ethereum/swarm/storage/localstore" ) const ( @@ -53,14 +54,14 @@ func newFakeNetFetcher(context.Context, storage.Address, *sync.Map) storage.NetF func NewTestHandler(datadir string, params *HandlerParams) (*TestHandler, error) { path := filepath.Join(datadir, testDbDirName) fh := NewHandler(params) - localstoreparams := storage.NewDefaultLocalStoreParams() - localstoreparams.Init(path) - localStore, err := storage.NewLocalStore(localstoreparams, nil) + + db, err := localstore.New(filepath.Join(path, "chunks"), make([]byte, 32), nil) if err != nil { - return nil, fmt.Errorf("localstore create fail, path %s: %v", path, err) + return nil, err } - localStore.Validators = append(localStore.Validators, storage.NewContentAddressValidator(storage.MakeHashFunc(feedsHashAlgorithm))) - localStore.Validators = append(localStore.Validators, fh) + + localStore := chunk.NewValidatorStore(db, storage.NewContentAddressValidator(storage.MakeHashFunc(feedsHashAlgorithm)), fh) + netStore, err := storage.NewNetStore(localStore, nil) if err != nil { return nil, err |