[sales] Fix intermittently failing test (#591)

This commit is contained in:
markspanbroek 2023-10-19 15:46:21 +02:00 committed by GitHub
parent c28627d16f
commit a77d0cdcec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -296,11 +296,14 @@ asyncchecksuite "Sales":
let blk = bt.Block.new( @[1.byte] ).get let blk = bt.Block.new( @[1.byte] ).get
onBatch(@[ blk ]) onBatch(@[ blk ])
return success() return success()
let sold = newFuture[void]()
sales.onSale = proc(request: StorageRequest, slotIndex: UInt256) =
sold.complete()
createAvailability() createAvailability()
let origSize = availability.size let origSize = availability.size
await market.requestStorage(request) await market.requestStorage(request)
await sleepAsync(2.millis) # allow proving to start await sold # allow proving to start
# complete request # complete request
market.slotState[request.slotId(slotIndex)] = SlotState.Finished market.slotState[request.slotId(slotIndex)] = SlotState.Finished