[fix] fix tests
This commit is contained in:
parent
5cb74b6638
commit
2db0131fa4
|
@ -7,7 +7,7 @@ import pkg/codex/storageproofs
|
||||||
type
|
type
|
||||||
MockProofs* = ref object of Proofs
|
MockProofs* = ref object of Proofs
|
||||||
periodicity: Periodicity
|
periodicity: Periodicity
|
||||||
cancelledRequests: HashSet[SlotId]
|
cancelledSlots: HashSet[SlotId]
|
||||||
proofsRequired: HashSet[SlotId]
|
proofsRequired: HashSet[SlotId]
|
||||||
proofsToBeRequired: HashSet[SlotId]
|
proofsToBeRequired: HashSet[SlotId]
|
||||||
proofEnds: Table[SlotId, UInt256]
|
proofEnds: Table[SlotId, UInt256]
|
||||||
|
@ -33,19 +33,15 @@ proc setProofRequired*(mock: MockProofs, id: SlotId, required: bool) =
|
||||||
else:
|
else:
|
||||||
mock.proofsRequired.excl(id)
|
mock.proofsRequired.excl(id)
|
||||||
|
|
||||||
proc setCancelled*(mock: MockProofs, id: SlotId, required: bool) =
|
proc setSlotCancelled*(mock: MockProofs, id: SlotId, required: bool) =
|
||||||
if required:
|
if required:
|
||||||
mock.cancelledRequests.incl(id)
|
mock.cancelledSlots.incl(id)
|
||||||
else:
|
else:
|
||||||
mock.cancelledRequests.excl(id)
|
mock.cancelledSlots.excl(id)
|
||||||
|
|
||||||
method isCancelled*(mock: MockProofs,
|
|
||||||
id: RequestId): Future[bool] {.async.} =
|
|
||||||
return mock.cancelledRequests.contains(id)
|
|
||||||
|
|
||||||
method isSlotCancelled*(mock: MockProofs,
|
method isSlotCancelled*(mock: MockProofs,
|
||||||
id: SlotId): Future[bool] {.async.} =
|
id: SlotId): Future[bool] {.async.} =
|
||||||
return mock.cancelledRequests.contains(id)
|
return mock.cancelledSlots.contains(id)
|
||||||
|
|
||||||
method isProofRequired*(mock: MockProofs,
|
method isProofRequired*(mock: MockProofs,
|
||||||
id: SlotId): Future[bool] {.async.} =
|
id: SlotId): Future[bool] {.async.} =
|
||||||
|
|
|
@ -101,7 +101,7 @@ suite "Proving":
|
||||||
proofs.setProofRequired(id, true)
|
proofs.setProofRequired(id, true)
|
||||||
await proofs.advanceToNextPeriod()
|
await proofs.advanceToNextPeriod()
|
||||||
proving.onProofRequired = onProofRequired
|
proving.onProofRequired = onProofRequired
|
||||||
proofs.setCancelled(id, true)
|
proofs.setSlotCancelled(id, true)
|
||||||
await proofs.advanceToNextPeriod()
|
await proofs.advanceToNextPeriod()
|
||||||
check not proving.slots.contains(id)
|
check not proving.slots.contains(id)
|
||||||
check not called
|
check not called
|
||||||
|
|
Loading…
Reference in New Issue