gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (b2d0ad57d -> 828e4ad3e)


From: gnunet
Subject: [taler-wallet-core] branch master updated (b2d0ad57d -> 828e4ad3e)
Date: Tue, 22 Aug 2023 08:55:36 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a change to branch master
in repository wallet-core.

    from b2d0ad57d sqlite3 backend for idb-bridge / wallet-core
     new f9d1c4a89 wallet-core: wake up task loop on tx status changes
     new 8c670bd06 wallet-core: simplify/optimize async condition
     new a748ebd05 harness: remove unused file
     new 828e4ad3e wallet-core: use sqlite for in-memory DB

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../integrationtests/scenario-prompt-payment.ts    | 59 ----------------------
 packages/taler-wallet-core/src/host-impl.node.ts   |  4 +-
 .../src/operations/transactions.ts                 |  1 +
 .../taler-wallet-core/src/util/promiseUtils.ts     | 24 ++++-----
 4 files changed, 16 insertions(+), 72 deletions(-)
 delete mode 100644 
packages/taler-harness/src/integrationtests/scenario-prompt-payment.ts

diff --git 
a/packages/taler-harness/src/integrationtests/scenario-prompt-payment.ts 
b/packages/taler-harness/src/integrationtests/scenario-prompt-payment.ts
deleted file mode 100644
index 7177a017c..000000000
--- a/packages/taler-harness/src/integrationtests/scenario-prompt-payment.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Imports.
- */
-import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
-import {
-  createSimpleTestkudosEnvironment,
-  withdrawViaBank,
-} from "../harness/helpers.js";
-
-/**
- * Run test for basic, bank-integrated withdrawal.
- */
-export async function runPromptPaymentScenario(t: GlobalTestState) {
-  // Set up test environment
-
-  const { wallet, bank, exchange, merchant } =
-    await createSimpleTestkudosEnvironment(t);
-
-  // Withdraw digital cash into the wallet.
-
-  await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" });
-
-  // Set up order.
-
-  const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", {
-    order: {
-      summary: "Buy me!",
-      amount: "TESTKUDOS:5",
-      fulfillment_url: "taler://fulfillment-success/thx",
-    },
-  });
-
-  let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, 
{
-    orderId: orderResp.order_id,
-  });
-
-  t.assertTrue(orderStatus.order_status === "unpaid");
-
-  console.log(orderStatus);
-
-  // Wait "forever"
-  await new Promise(() => {});
-}
diff --git a/packages/taler-wallet-core/src/host-impl.node.ts 
b/packages/taler-wallet-core/src/host-impl.node.ts
index ceda7243f..6a4f21d79 100644
--- a/packages/taler-wallet-core/src/host-impl.node.ts
+++ b/packages/taler-wallet-core/src/host-impl.node.ts
@@ -148,9 +148,11 @@ export async function createNativeWalletHost2(
 
   let dbResp: MakeDbResult;
 
-  if (!args.persistentStoragePath || 
args.persistentStoragePath.endsWith(".json")) {
+  if (args.persistentStoragePath 
&&args.persistentStoragePath.endsWith(".json")) {
+    logger.info("using legacy file-based DB backend");
     dbResp = await makeFileDb(args);
   } else {
+    logger.info("using sqlite3 DB backend");
     dbResp = await makeSqliteDb(args);
   }
 
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts 
b/packages/taler-wallet-core/src/operations/transactions.ts
index af04cb161..7f5302b25 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -1916,4 +1916,5 @@ export function notifyTransition(
       transactionId,
     });
   }
+  ws.workAvailable.trigger();
 }
diff --git a/packages/taler-wallet-core/src/util/promiseUtils.ts 
b/packages/taler-wallet-core/src/util/promiseUtils.ts
index d409686d9..23f1c06a5 100644
--- a/packages/taler-wallet-core/src/util/promiseUtils.ts
+++ b/packages/taler-wallet-core/src/util/promiseUtils.ts
@@ -23,6 +23,8 @@ export interface OpenedPromise<T> {
 /**
  * Get an unresolved promise together with its extracted resolve / reject
  * function.
+ *
+ * Recent ECMAScript proposals also call this a promise capability.
  */
 export function openPromise<T>(): OpenedPromise<T> {
   let resolve: ((x?: any) => void) | null = null;
@@ -39,22 +41,20 @@ export function openPromise<T>(): OpenedPromise<T> {
 }
 
 export class AsyncCondition {
-  private _waitPromise: Promise<void>;
-  private _resolveWaitPromise: (val: void) => void;
-  constructor() {
-    const op = openPromise<void>();
-    this._waitPromise = op.promise;
-    this._resolveWaitPromise = op.resolve;
-  }
+  private promCap?: OpenedPromise<void> = undefined;
+  constructor() {}
 
   wait(): Promise<void> {
-    return this._waitPromise;
+    if (!this.promCap) {
+      this.promCap = openPromise<void>();
+    }
+    return this.promCap.promise;
   }
 
   trigger(): void {
-    this._resolveWaitPromise();
-    const op = openPromise<void>();
-    this._waitPromise = op.promise;
-    this._resolveWaitPromise = op.resolve;
+    if (this.promCap) {
+      this.promCap.resolve();
+    }
+    this.promCap = undefined;
   }
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]