Skip to content

Commit 9f13e43

Browse files
authored
Merge pull request #1756 from 0chain/fix-search
fix: search
2 parents c02e595 + 857967e commit 9f13e43

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

zboxcore/sdk/filemetaworker.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,19 @@ func (req *ListRequest) getFileConsensusFromBlobbers() (zboxutil.Uint128, zboxut
256256
func (req *ListRequest) getMultipleFileConsensusFromBlobbers() (zboxutil.Uint128, zboxutil.Uint128, []*fileref.FileRef, []*fileMetaByNameResponse) {
257257
lR := req.getFileMetaByNameFromBlobbers()
258258
var filerRefs []*fileref.FileRef
259-
uniquePathHashes := map[string]bool{}
259+
uniqueFileMetaHash := map[string]bool{}
260260
for i := 0; i < len(lR); i++ {
261261
ti := lR[i]
262262
if ti.err != nil || len(ti.filerefs) == 0 {
263263
continue
264264
}
265265
for _, fileRef := range ti.filerefs {
266-
uniquePathHashes[fileRef.PathHash] = true
266+
uniqueFileMetaHash[fileRef.FileMetaHash] = true
267267
}
268268
}
269269
// take the pathhash as unique and for each path hash append the fileref which have consensus.
270270

271-
for pathHash := range uniquePathHashes {
271+
for fileMetaHash := range uniqueFileMetaHash {
272272
req.consensus = 0
273273
retMap := make(map[string]int)
274274
outerLoop:
@@ -281,8 +281,7 @@ func (req *ListRequest) getMultipleFileConsensusFromBlobbers() (zboxutil.Uint128
281281
if fRef == nil {
282282
continue
283283
}
284-
if pathHash == fRef.PathHash {
285-
fileMetaHash := fRef.FileMetaHash
284+
if fileMetaHash == fRef.FileMetaHash {
286285
retMap[fileMetaHash]++
287286
if retMap[fileMetaHash] > req.consensus {
288287
req.consensus = retMap[fileMetaHash]

0 commit comments

Comments
 (0)