aboutsummaryrefslogtreecommitdiff
path: root/src/wallet-impl/withdraw.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet-impl/withdraw.ts')
-rw-r--r--src/wallet-impl/withdraw.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wallet-impl/withdraw.ts b/src/wallet-impl/withdraw.ts
index 3122a463c..5d89f64a9 100644
--- a/src/wallet-impl/withdraw.ts
+++ b/src/wallet-impl/withdraw.ts
@@ -260,17 +260,17 @@ async function processPlanchet(
let withdrawSessionFinished = false;
let reserveDepleted = false;
- await runWithWriteTransaction(
+ const success = await runWithWriteTransaction(
ws.db,
[Stores.coins, Stores.withdrawalSession, Stores.reserves],
async tx => {
const ws = await tx.get(Stores.withdrawalSession, withdrawalSessionId);
if (!ws) {
- return;
+ return false;
}
if (ws.withdrawn[coinIdx]) {
// Already withdrawn
- return;
+ return false;
}
ws.withdrawn[coinIdx] = true;
ws.lastCoinErrors[coinIdx] = undefined;
@@ -301,9 +301,16 @@ async function processPlanchet(
}
}
await tx.add(Stores.coins, coin);
+ return true;
},
);
+ if (success) {
+ ws.notify( {
+ type: NotificationType.CoinWithdrawn,
+ } );
+ }
+
if (withdrawSessionFinished) {
ws.notify({
type: NotificationType.WithdrawSessionFinished,
@@ -503,6 +510,7 @@ async function incrementWithdrawalRetry(
wsr.lastError = err;
await tx.put(Stores.withdrawalSession, wsr);
});
+ ws.notify({ type: NotificationType.WithdrawOperationError });
}
export async function processWithdrawSession(