mirror of
https://github.com/status-im/nim-codex.git
synced 2025-01-18 23:01:43 +00:00
b8ee2ac71e
* rework merkle tree support * rename merkletree -> codexmerkletree * treed and proof encoding/decoding * style * adding codex merkle and coders tests * use default hash codec * proof size changed * add from nodes test * shorte file names * wip poseidon tree * shorten file names * root returns a result * import poseidon tests * update multicodecs * consolidating codex types and adding new codecs * update codec * remove temp codecs constants * move codecs related stuff out * updating codecs * misc * updating sizes since block size was adjusted to 64kb * fix merge issues and cleanup a few warnings
25 lines
745 B
Nim
25 lines
745 B
Nim
import pkg/metrics
|
|
import pkg/chronicles
|
|
import ../statemachine
|
|
import ./errorhandling
|
|
|
|
declareCounter(codex_purchases_cancelled, "codex purchases cancelled")
|
|
|
|
logScope:
|
|
topics = "marketplace purchases cancelled"
|
|
|
|
type PurchaseCancelled* = ref object of ErrorHandlingState
|
|
|
|
method `$`*(state: PurchaseCancelled): string =
|
|
"cancelled"
|
|
|
|
method run*(state: PurchaseCancelled, machine: Machine): Future[?State] {.async.} =
|
|
codex_purchases_cancelled.inc()
|
|
let purchase = Purchase(machine)
|
|
|
|
warn "Request cancelled, withdrawing remaining funds", requestId = $purchase.requestId
|
|
await purchase.market.withdrawFunds(purchase.requestId)
|
|
|
|
let error = newException(Timeout, "Purchase cancelled due to timeout")
|
|
purchase.future.fail(error)
|