mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-22 17:48:24 +00:00
26 lines
596 B
Nim
26 lines
596 B
Nim
import ../statemachine
|
|
import ./filling
|
|
import ./cancelled
|
|
import ./failed
|
|
import ./filled
|
|
import ./errored
|
|
|
|
type
|
|
SaleProving* = ref object of State
|
|
SaleProvingError* = object of CatchableError
|
|
|
|
method `$`*(state: SaleProving): string = "SaleProving"
|
|
|
|
method run*(state: SaleProving, machine: Machine): Future[?State] {.async.} =
|
|
let agent = SalesAgent(machine)
|
|
|
|
try:
|
|
without onProve =? agent.sales.onProve:
|
|
raiseAssert "onProve callback not set"
|
|
|
|
let proof = await onProve(agent.request, agent.slotIndex)
|
|
agent.proof.setValue(proof)
|
|
|
|
except CancelledError:
|
|
raise
|