[WIP sales] make storage available again upon failure
This commit is contained in:
parent
a7f3ead44e
commit
5abd5dd674
|
@ -153,6 +153,7 @@ proc start(negotiation: Negotiation) {.async.} =
|
|||
negotiation.waiting = some negotiation.waitForExpiry()
|
||||
except CatchableError as e:
|
||||
error "Negotiation failed", msg = e.msg
|
||||
negotiation.finish(success = false)
|
||||
|
||||
proc handleRequest(sales: Sales, requestId: array[32, byte], ask: StorageAsk) =
|
||||
without availability =? sales.findAvailability(ask):
|
||||
|
|
|
@ -80,6 +80,13 @@ suite "Sales":
|
|||
discard await market.requestStorage(request)
|
||||
check retrievingCid == request.content.cid
|
||||
|
||||
test "makes storage available again when data retrieval fails":
|
||||
let error = newException(IOError, "data retrieval failed")
|
||||
sales.retrieve = proc(cid: string) {.async.} = raise error
|
||||
sales.add(availability)
|
||||
discard await market.requestStorage(request)
|
||||
check sales.available == @[availability]
|
||||
|
||||
test "generates proof of storage":
|
||||
var provingCid: string
|
||||
sales.prove = proc(cid: string): Future[seq[byte]] {.async.} = provingCid = cid
|
||||
|
|
Loading…
Reference in New Issue