webapi: /explore optional &offset= parameter which does not make sense to be used

This commit is contained in:
Kleissner
2022-10-14 16:28:43 +02:00
parent 0e3e8dc988
commit 34be2cc964
3 changed files with 12 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ import (
)
// queryRecentShared returns recently shared files on the network from random peers until the limit is reached.
func (api *WebapiInstance) queryRecentShared(backend *core.Backend, fileType int, limitPeer, limitTotal uint64) (files []blockchain.BlockRecordFile) {
func (api *WebapiInstance) queryRecentShared(backend *core.Backend, fileType int, limitPeer, offsetTotal, limitTotal uint64) (files []blockchain.BlockRecordFile) {
if limitPeer == 0 {
limitPeer = 1
}
@@ -50,13 +50,18 @@ func (api *WebapiInstance) queryRecentShared(backend *core.Backend, fileType int
// found a new file! append.
if filesFromPeer < limitPeer {
filesFromPeer++
if offsetTotal > 0 {
offsetTotal--
continue
}
files = append(files, file)
if uint64(len(files)) >= limitTotal {
return
}
filesFromPeer++
} else if uint64(len(filesSeconday)) < limitTotal-uint64(len(files)) {
filesSeconday = append(filesSeconday, file)
} else {