mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
swarm/storage: with toEncrypt flag
This commit is contained in:
parent
eb2d20ff17
commit
3dc9065680
2 changed files with 3 additions and 3 deletions
|
|
@ -98,11 +98,11 @@ func (f *FileStore) HashSize() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public API. This endpoint returns all chunk hashes (only) for a given file
|
// 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)
|
addrs = make([]Address, 0)
|
||||||
// create a special kind of putter, which only will store the references
|
// create a special kind of putter, which only will store the references
|
||||||
putter := &HashExplorer{
|
putter := &HashExplorer{
|
||||||
hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, false),
|
hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, toEncrypt),
|
||||||
References: make([]Reference, 0),
|
References: make([]Reference, 0),
|
||||||
}
|
}
|
||||||
// do the actual splitting anyway, no way around it
|
// do the actual splitting anyway, no way around it
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ func TestGetAllReferences(t *testing.T) {
|
||||||
checkRefs := func(dataSize int, expectedLen int) {
|
checkRefs := func(dataSize int, expectedLen int) {
|
||||||
slice := testutil.RandomBytes(1, dataSize)
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue