mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-08-08 18:03:37 +00:00
fixes checking block results
This commit is contained in:
parent
42b74cc11f
commit
774f6d2841
@ -436,10 +436,14 @@ proc fetchPieces*(
|
||||
let address = BlockAddress.init(cid, blockIter.next())
|
||||
self.networkStore.getBlock(address)
|
||||
|
||||
without blocks =? await allFinishedValues(blockFutures), err:
|
||||
without blockResults =? await allFinishedValues(blockFutures), err:
|
||||
return failure(err)
|
||||
|
||||
if err =? self.validatePiece(pieceValidator, blocks).errorOption:
|
||||
let numOfFailedBlocks = blockResults.countIt(it.isFailure)
|
||||
if numOfFailedBlocks > 0:
|
||||
return failure("Some blocks failed to fetch")
|
||||
|
||||
if err =? self.validatePiece(pieceValidator, blockResults.mapIt(it.get)).errorOption:
|
||||
return failure(err)
|
||||
|
||||
await sleepAsync(1.millis)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user