commit f677d455d3e92f88f60c3ba5b7ac3674f2a04ccc
parent fe99c01b4a6ce8c3098612566a07b7e1eac81d47
Author: Florian Dold <florian@dold.me>
Date: Mon, 24 Apr 2023 23:43:50 +0200
withdrawal tx fixes
Diffstat:
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/design-documents/037-wallet-transactions-lifecycle.rst b/design-documents/037-wallet-transactions-lifecycle.rst
@@ -189,8 +189,9 @@ Transaction Type: Withdrawal
the bank did not return success or failure.
* ``[bank-poll-success] => pending(exchange-wait-reserve)``
- * ``[bank-poll-denied] => deleted``: We show a transient message that the operation was denied in the bank.
- * ``[exchange-poll-success] => pending(withdrawing-coins)``
+ * ``[bank-aborted] => aborted``: Bank denied the operation.
+ * ``[exchange-poll-success] => pending(withdrawing-coins)``: Optional
+ short-cut transition. Exchange was faster than the bank.
* ``[action:abort] => aborting(wallet-to-bank)``
* ``aborting(wallet-to-bank)``
@@ -205,14 +206,16 @@ Transaction Type: Withdrawal
``suspended(after-wired)`` (treating the ``abort`` action as a ``suspend``
action).
- * ``[processed-success] => deleted``: We show a transient message that the
- operation was aborted.
- * ``[processed-error(already-confirmed)] => suspended(after-wired)``: We
+ * ``[processed-success] => aborted``
+ * ``[processed-error(already-confirmed)] => suspended(exchange-wait-reserve)``: We
keep a transaction history entry reminding the user about when the already
wired funds will be returned.
- * ``[processed-error(unknown-transaction)] => deleted``
+ * ``[processed-error(unknown-transaction)] => failed``
+
+* ``suspended(exchange-wait-reserve)``
-* ``suspended(after-wired)``
+ State where funds were (presumably) wired to the exchange but the wallet
+ was asked to not proceed with the withdraw, but we still resume.
In this state, the wallet should show to the user that the money from the
withdrawal reserve will be sent back to the originating bank account after
@@ -231,14 +234,6 @@ Transaction Type: Withdrawal
* ``[exchange-poll-success] => pending(withdrawing-coins)``
* ``[action:suspend] => suspended(after-wired)``
-* ``suspended(after-wired)``
-
- State where funds were (presumably) wired to the exchange but the wallet
- was asked to not proceed with the withdraw, but we still resume.
-
- * ``[action:resume] => pending(exchange-wait-reserves)``
- * ``[action:delete] => deleted``
-
* ``pending(withdrawing-coins)``
State where we are finally withdrawing the actual coins. Depending on
diff --git a/transaction-withdrawal-states.dot b/transaction-withdrawal-states.dot
@@ -9,10 +9,12 @@ digraph G {
pending_kyc[label="pending(kyc)"];
pending_aml[label="pending(aml)"];
done[label="done", shape="box"];
- suspended_aw[label="suspended(after-wired)", shape="box"];
+ suspended_ewr[label="suspended(exchange-wait-reserve)", shape="box"];
suspended_aml[label="suspended(aml)", shape="box"];
suspended_kyc[label="suspended(kyc)", shape="box"];
aborting_w2b[label="aborting(wallet-to-bank)"];
+ aborted[label="aborted", shape="box"];
+ failed[label="failed", shape="box"];
deleted[label="deleted", shape="box"];
subgraph {
@@ -20,7 +22,7 @@ digraph G {
}
subgraph {
- rank = same; suspended_wc; suspended_aw; suspended_aml; suspended_kyc;
+ rank = same; suspended_wc; suspended_ewr; suspended_aml; suspended_kyc;
}
subgraph {
@@ -30,13 +32,13 @@ digraph G {
initial->pending_brr [color="blue", label="bank integrated withdraw"];
initial->pending_ewr [color="blue", xlabel="manual withdraw"];
pending_brr->pending_bc;
- pending_brr->aborting_w2b [color="blue", label="cancel"];
- pending_brr->deleted [color="red", label="error"];
+ pending_brr->aborting_w2b [color="blue", label="abort"];
+ pending_brr->aborted [color="red", label="error"];
pending_bc->pending_ewr [label="bank-poll:\napproved"];
pending_bc->pending_wc [xlabel="exchange-poll:\nreserve ready",style="dotted"];
pending_bc->aborting_w2b [color="blue", label="cancel"];
- pending_bc->deleted [label="bank-poll:\ndenied"];
+ pending_bc->failed [label="bank-poll:\ndenied"];
pending_ewr->pending_wc [label="exchange-poll:\nreserve ready"];
pending_wc->pending_kyc;
@@ -48,19 +50,21 @@ digraph G {
suspended_aml->pending_aml [color="blue", label="resume"];
suspended_kyc->pending_kyc [color="blue", label="resume"];
- aborting_w2b->deleted;
- aborting_w2b->suspended_aw [color="red", label="error(already-confirmed)"];
- aborting_w2b->deleted [color="red", label="error(unknown-transaction)"];
+ aborting_w2b->suspended_ewr [color="red", label="error(already-confirmed)"];
+ aborting_w2b->failed [color="red", label="error(unknown-transaction)"];
- pending_ewr->suspended_aw [color="blue", label="suspend"];
+ pending_ewr->suspended_ewr [color="blue", label="suspend"];
- suspended_aw->pending_ewr [color="blue", label="resume"];
- suspended_aw->deleted [color="blue", label="delete"];
+ suspended_ewr->pending_ewr [color="blue", label="resume"];
pending_wc->suspended_wc [color="blue", label="suspend"];
suspended_wc->pending_wc [color="blue", label="resume"];
+ suspended_ewr->deleted [color="blue", label="delete"];
+ aborting_w2b->deleted;
+ failed->deleted;
+ aborted->deleted;
done->deleted [color="blue", label="delete"];
suspended_aml->deleted [color="blue", label="delete"];
suspended_kyc->deleted [color="blue", label="delete"];