mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
swarm/storage: sorted references for GetAllReferences
This commit is contained in:
parent
efa7a4083f
commit
61752ac4dc
1 changed files with 2 additions and 3 deletions
|
|
@ -99,8 +99,7 @@ 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, toEncrypt bool) (addrs []Address, err error) {
|
||||
addrs = make([]Address, 0)
|
||||
func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader, toEncrypt bool) (addrs AddressCollection, err error) {
|
||||
// create a special kind of putter, which only will store the references
|
||||
putter := &HashExplorer{
|
||||
hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, toEncrypt),
|
||||
|
|
@ -114,7 +113,7 @@ func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader, toEncr
|
|||
// collect all references
|
||||
addrs = NewAddressCollection(0)
|
||||
for _, ref := range putter.References {
|
||||
addrs = append(addrs, Address(ref))
|
||||
arr = append(arr, Address(ref))
|
||||
}
|
||||
sort.Sort(addrs)
|
||||
return addrs, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue