[marketplace] Catch slot empty, return default values

This commit is contained in:
Eric Mastro 2022-09-13 16:33:04 +10:00 committed by Eric Mastro
parent 9d218c88a5
commit 8dd110765f
1 changed files with 12 additions and 3 deletions

View File

@ -24,15 +24,24 @@ method periodicity*(proofs: OnChainProofs): Future[Periodicity] {.async.} =
method isProofRequired*(proofs: OnChainProofs,
id: SlotId): Future[bool] {.async.} =
return await proofs.storage.isProofRequired(id)
try:
return await proofs.storage.isProofRequired(id)
except ValueError:
return false
method willProofBeRequired*(proofs: OnChainProofs,
id: SlotId): Future[bool] {.async.} =
return await proofs.storage.willProofBeRequired(id)
try:
return await proofs.storage.willProofBeRequired(id)
except ValueError:
return false
method getProofEnd*(proofs: OnChainProofs,
id: SlotId): Future[UInt256] {.async.} =
return await proofs.storage.proofEnd(id)
try:
return await proofs.storage.proofEnd(id)
except ValueError:
return 0.u256
method submitProof*(proofs: OnChainProofs,
id: SlotId,