mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-27 03:50:31 +00:00
[purchasing] Remove Purchase.selected
There no longer exists a single host that is selected for a contract.
This commit is contained in:
parent
ac6d17e895
commit
698baeef35
@ -21,7 +21,6 @@ type
|
|||||||
market: Market
|
market: Market
|
||||||
clock: Clock
|
clock: Clock
|
||||||
request*: StorageRequest
|
request*: StorageRequest
|
||||||
selected*: ?Address
|
|
||||||
PurchaseTimeout* = Timeout
|
PurchaseTimeout* = Timeout
|
||||||
|
|
||||||
const DefaultProofProbability = 100.u256
|
const DefaultProofProbability = 100.u256
|
||||||
@ -77,10 +76,7 @@ proc run(purchase: Purchase) {.async.} =
|
|||||||
done.complete()
|
done.complete()
|
||||||
let request = purchase.request
|
let request = purchase.request
|
||||||
let subscription = await market.subscribeFulfillment(request.id, callback)
|
let subscription = await market.subscribeFulfillment(request.id, callback)
|
||||||
try:
|
|
||||||
await done
|
await done
|
||||||
purchase.selected = await market.getHost(request.id)
|
|
||||||
finally:
|
|
||||||
await subscription.unsubscribe()
|
await subscription.unsubscribe()
|
||||||
|
|
||||||
proc withTimeout(future: Future[void]) {.async.} =
|
proc withTimeout(future: Future[void]) {.async.} =
|
||||||
|
@ -44,5 +44,4 @@ func `%`*(purchase: Purchase): JsonNode =
|
|||||||
"finished": purchase.finished,
|
"finished": purchase.finished,
|
||||||
"error": purchase.error.?msg,
|
"error": purchase.error.?msg,
|
||||||
"request": purchase.request,
|
"request": purchase.request,
|
||||||
"selected": purchase.selected
|
|
||||||
}
|
}
|
||||||
|
@ -103,5 +103,4 @@ ethersuite "Integration tests":
|
|||||||
let purchase = waitFor upload().buy().finish()
|
let purchase = waitFor upload().buy().finish()
|
||||||
|
|
||||||
check purchase["error"].getStr == ""
|
check purchase["error"].getStr == ""
|
||||||
check purchase["selected"].getStr == $accounts[1]
|
|
||||||
check available().len == 0
|
check available().len == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user