swap orders as a state machine persisted in sqlite, resumed on restart #39
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #7
Scope
An
Orderinwallet-entitiesand a state machine inwallet-core(Quoted → AwaitingDeposit → Processing → Success | Refunded | Failed, withExpiredon the quote deadline), persisted bywallet-datain SQLite, polled with backoff while non-terminal, and resumed on app start. Deposits the wallet makes itself (a Quantus leg, later) record the tx hash and calldeposit/submit.Acceptance
Kill the app mid-order; on restart the order is still there and reaches its terminal state. A quote past its deadline shows as expired without a network call.
Depends on
The 1Click client.
Built:
wallet_core::orders(the state machine, unit-tested for forward-only moves, expiry without a network call, and the backoff schedule), anOrderStoreport on the SQLite file, and the follower incrates/wallet-app/src/swap.rsthat resumes every open order at start and polls with backoff and jitter, persisting each move and emittingorders:updated.What is not yet exercised end to end: a real order. 1Click answers dry quotes without a credential but refuses a wet one (
400 Failed to get quote), so no deposit address can be reserved until the partner JWT exists and the relay (#40) attaches it. The "kill the app mid-order" acceptance runs the moment one real order exists; the store and the resume path it needs are in place and tested at the unit level. Leaving this open for that.