fix results stuff
This commit is contained in:
parent
96862372e5
commit
ebc284ae6a
|
@ -56,8 +56,20 @@ proc prove*[H](
|
|||
let args = ProveTaskArgs(signal: signal, params: self.params)
|
||||
let flowvar = self.tp.spawn proveTask(args, input)
|
||||
|
||||
without res =? await awaitThreadResult(signal, flowvar), err:
|
||||
return failure(err)
|
||||
without taskRes =? await awaitThreadResult(signal, flowvar), err:
|
||||
let res: ?!CircomProof = failure(err)
|
||||
return res
|
||||
|
||||
without proof =? taskRes.mapFailure, err:
|
||||
let res: ?!CircomProof = failure(err)
|
||||
return res
|
||||
|
||||
let sigRes = signal.close()
|
||||
if sigRes.isErr:
|
||||
return failure(sigRes.error())
|
||||
|
||||
let pf: CircomProof = proof
|
||||
success(pf)
|
||||
|
||||
proc verify*[H](
|
||||
self: AsyncCircomCompat, proof: CircomProof, inputs: ProofInputs[H]
|
||||
|
|
|
@ -15,11 +15,12 @@ proc awaitThreadResult*[T](signal: ThreadSignalPtr, handle: Flowvar[T]): Future[
|
|||
var
|
||||
res: T
|
||||
awaitTotal: Duration
|
||||
|
||||
while awaitTotal < CompletionTimeout:
|
||||
if handle.tryComplete(res):
|
||||
return success(res)
|
||||
else:
|
||||
awaitTotal += CompletionRetryDelay
|
||||
await sleepAsync(CompletionRetryDelay)
|
||||
if handle.tryComplete(res):
|
||||
return success(res)
|
||||
else:
|
||||
awaitTotal += CompletionRetryDelay
|
||||
await sleepAsync(CompletionRetryDelay)
|
||||
|
||||
return failure("Task signaled finish but didn't return any result within " & $CompletionRetryDelay)
|
Loading…
Reference in New Issue