[fix] fix tests

This commit is contained in:
Eric Mastro 2022-08-26 13:42:01 +10:00 committed by Eric Mastro
parent 5cb74b6638
commit 2db0131fa4
2 changed files with 6 additions and 10 deletions

View File

@ -7,7 +7,7 @@ import pkg/codex/storageproofs
type
MockProofs* = ref object of Proofs
periodicity: Periodicity
cancelledRequests: HashSet[SlotId]
cancelledSlots: HashSet[SlotId]
proofsRequired: HashSet[SlotId]
proofsToBeRequired: HashSet[SlotId]
proofEnds: Table[SlotId, UInt256]
@ -33,19 +33,15 @@ proc setProofRequired*(mock: MockProofs, id: SlotId, required: bool) =
else:
mock.proofsRequired.excl(id)
proc setCancelled*(mock: MockProofs, id: SlotId, required: bool) =
proc setSlotCancelled*(mock: MockProofs, id: SlotId, required: bool) =
if required:
mock.cancelledRequests.incl(id)
mock.cancelledSlots.incl(id)
else:
mock.cancelledRequests.excl(id)
method isCancelled*(mock: MockProofs,
id: RequestId): Future[bool] {.async.} =
return mock.cancelledRequests.contains(id)
mock.cancelledSlots.excl(id)
method isSlotCancelled*(mock: MockProofs,
id: SlotId): Future[bool] {.async.} =
return mock.cancelledRequests.contains(id)
return mock.cancelledSlots.contains(id)
method isProofRequired*(mock: MockProofs,
id: SlotId): Future[bool] {.async.} =

View File

@ -101,7 +101,7 @@ suite "Proving":
proofs.setProofRequired(id, true)
await proofs.advanceToNextPeriod()
proving.onProofRequired = onProofRequired
proofs.setCancelled(id, true)
proofs.setSlotCancelled(id, true)
await proofs.advanceToNextPeriod()
check not proving.slots.contains(id)
check not called