mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 03:47:18 +00:00
cli: fix fetchLatestMissingBlockIndex in upload-bin
command
Close #3667 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
c2b4d32224
commit
6e863e9a06
1 changed files with 3 additions and 3 deletions
|
@ -185,7 +185,7 @@ type searchResult struct {
|
||||||
func fetchLatestMissingBlockIndex(ctx context.Context, p *pool.Pool, containerID cid.ID, priv *keys.PrivateKey, attributeKey string, currentHeight int, maxParallelSearches, maxRetries int) (int, error) {
|
func fetchLatestMissingBlockIndex(ctx context.Context, p *pool.Pool, containerID cid.ID, priv *keys.PrivateKey, attributeKey string, currentHeight int, maxParallelSearches, maxRetries int) (int, error) {
|
||||||
var (
|
var (
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
numBatches = currentHeight/searchBatchSize + 1
|
numBatches = currentHeight / searchBatchSize
|
||||||
emptyBatchFound bool
|
emptyBatchFound bool
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -228,12 +228,12 @@ func fetchLatestMissingBlockIndex(ctx context.Context, p *pool.Pool, containerID
|
||||||
if results[i].err != nil {
|
if results[i].err != nil {
|
||||||
return 0, fmt.Errorf("blocks search failed for batch with indexes from %d to %d: %w", results[i].startIndex, results[i].endIndex-1, results[i].err)
|
return 0, fmt.Errorf("blocks search failed for batch with indexes from %d to %d: %w", results[i].startIndex, results[i].endIndex-1, results[i].err)
|
||||||
}
|
}
|
||||||
if results[i].numOIDs < searchBatchSize {
|
if results[i].numOIDs == 0 {
|
||||||
emptyBatchFound = true
|
emptyBatchFound = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if emptyBatchFound || (batch == numBatches && i == len(results)-1) {
|
if emptyBatchFound || (batch == numBatches && i == len(results)-1) {
|
||||||
return results[i].startIndex + searchBatchSize, nil
|
return results[i].startIndex, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue