From 3dc906568084985529515dc2e89c7dd25a2c1a51 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Sun, 3 Feb 2019 20:31:11 -0500 Subject: [PATCH] swarm/storage: with toEncrypt flag --- swarm/storage/filestore.go | 4 ++-- swarm/storage/filestore_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swarm/storage/filestore.go b/swarm/storage/filestore.go index 410b4407b1..9ed57a5b3a 100644 --- a/swarm/storage/filestore.go +++ b/swarm/storage/filestore.go @@ -98,11 +98,11 @@ func (f *FileStore) HashSize() int { } // Public API. This endpoint returns all chunk hashes (only) for a given file -func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader) (addrs []Address, err error) { +func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader, toEncrypt bool) (addrs []Address, err error) { addrs = make([]Address, 0) // create a special kind of putter, which only will store the references putter := &HashExplorer{ - hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, false), + hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, toEncrypt), References: make([]Reference, 0), } // do the actual splitting anyway, no way around it diff --git a/swarm/storage/filestore_test.go b/swarm/storage/filestore_test.go index f46ce86b76..2dbccdf114 100644 --- a/swarm/storage/filestore_test.go +++ b/swarm/storage/filestore_test.go @@ -193,7 +193,7 @@ func TestGetAllReferences(t *testing.T) { checkRefs := func(dataSize int, expectedLen int) { slice := testutil.RandomBytes(1, dataSize) - addrs, err := fileStore.GetAllReferences(context.Background(), bytes.NewReader(slice)) + addrs, err := fileStore.GetAllReferences(context.Background(), bytes.NewReader(slice), false) if err != nil { t.Fatal(err) }