aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-01-18 23:32:03 +0100
committerFlorian Dold <florian.dold@gmail.com>2020-01-18 23:32:14 +0100
commitaf57a404d070500ce63ed9ed0dfce721e82e4801 (patch)
tree39e97aefffe61c568b64c1d71d66b48e26c905ce /src/wallet.ts
parentfcb0565323d3134ec2dc376700ef85a2c7b7becd (diff)
fix and test case for "insecure" taler://refund URIs
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index a89d2d567..32a92cee0 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -248,6 +248,31 @@ export class Wallet {
n.type === NotificationType.WaitingForRetry &&
n.numGivingLiveness == 0
) {
+ logger.trace("no liveness-giving operations left, returning");
+ resolve();
+ }
+ });
+ this.runRetryLoop().catch(e => {
+ console.log("exception in wallet retry loop");
+ reject(e);
+ });
+ });
+ await p;
+ }
+
+ /**
+ * Run the wallet until there are no more pending operations that give
+ * liveness left. The wallet will be in a stopped state when this function
+ * returns without resolving to an exception.
+ */
+ public async runUntilDoneAndStop(): Promise<void> {
+ const p = new Promise((resolve, reject) => {
+ // Run this asynchronously
+ this.addNotificationListener(n => {
+ if (
+ n.type === NotificationType.WaitingForRetry &&
+ n.numGivingLiveness == 0
+ ) {
logger.trace("no liveness-giving operations left, stopping");
this.stop();
}