[purchasing] set selected offer on purchase
This commit is contained in:
parent
d8ef633fb0
commit
8086dda3f2
|
@ -81,6 +81,7 @@ proc selectOffer(purchase: Purchase) {.async.} =
|
|||
cheapest = some offer
|
||||
if cheapest =? cheapest:
|
||||
await purchase.market.selectOffer(cheapest.id)
|
||||
purchase.selected = some cheapest
|
||||
|
||||
proc run(purchase: Purchase) {.async.} =
|
||||
proc onOffer(offer: StorageOffer) =
|
||||
|
|
|
@ -92,6 +92,7 @@ suite "Purchasing":
|
|||
discard await market.offerStorage(offer2)
|
||||
clock.set(request.expiry.truncate(int64))
|
||||
await purchase.wait()
|
||||
check purchase.selected == some offer2
|
||||
check market.selected[0] == offer2.id
|
||||
|
||||
test "ignores offers that expired":
|
||||
|
|
Loading…
Reference in New Issue