[purchasing] set selected offer on purchase

This commit is contained in:
Mark Spanbroek 2022-05-18 13:27:01 +02:00 committed by markspanbroek
parent d8ef633fb0
commit 8086dda3f2
2 changed files with 2 additions and 0 deletions

View File

@ -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) =

View File

@ -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":