gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: create dev exper


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: create dev experiment for pending refresh
Date: Mon, 29 Jan 2024 22:20:59 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new 95e87d8f4 wallet-core: create dev experiment for pending refresh
95e87d8f4 is described below

commit 95e87d8f4863f3db37504e78913381f775f8f73a
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 29 22:20:57 2024 +0100

    wallet-core: create dev experiment for pending refresh
---
 packages/taler-wallet-core/src/dev-experiments.ts  | 39 ++++++++++++++++++++--
 .../taler-wallet-core/src/operations/refresh.ts    |  4 ++-
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/packages/taler-wallet-core/src/dev-experiments.ts 
b/packages/taler-wallet-core/src/dev-experiments.ts
index cb8f7aa19..be42557e5 100644
--- a/packages/taler-wallet-core/src/dev-experiments.ts
+++ b/packages/taler-wallet-core/src/dev-experiments.ts
@@ -25,8 +25,20 @@
  * Imports.
  */
 
-import { Logger, parseDevExperimentUri } from "@gnu-taler/taler-util";
-import { ConfigRecordKey } from "./db.js";
+import {
+  Logger,
+  RefreshReason,
+  TalerPreciseTimestamp,
+  encodeCrock,
+  getRandomBytes,
+  parseDevExperimentUri,
+} from "@gnu-taler/taler-util";
+import {
+  ConfigRecordKey,
+  RefreshGroupRecord,
+  RefreshOperationStatus,
+  timestampPreciseToDb,
+} from "./db.js";
 import { InternalWalletState } from "./internal-wallet-state.js";
 import {
   HttpRequestLibrary,
@@ -54,6 +66,29 @@ export async function applyDevExperiment(
       "can't handle devmode URI (other than enable-devmode) unless devmode is 
active",
     );
   }
+
+  if (parsedUri.devExperimentId == "insert-pending-refresh") {
+    await ws.db.runReadWriteTx(["refreshGroups"], async (tx) => {
+      const refreshGroupId = encodeCrock(getRandomBytes(32));
+      const newRg: RefreshGroupRecord = {
+        currency: "DEVKUDOS",
+        expectedOutputPerCoin: [],
+        inputPerCoin: [],
+        oldCoinPubs: [],
+        operationStatus: RefreshOperationStatus.Pending,
+        reason: RefreshReason.Manual,
+        refreshGroupId,
+        statusPerCoin: [],
+        timestampCreated: timestampPreciseToDb(TalerPreciseTimestamp.now()),
+        timestampFinished: undefined,
+        originatingTransactionId: undefined,
+        infoPerExchange: {},
+      };
+      await tx.refreshGroups.put(newRg);
+    });
+    return;
+  }
+
   throw Error(`dev-experiment id not understood ${parsedUri.devExperimentId}`);
 }
 
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts 
b/packages/taler-wallet-core/src/operations/refresh.ts
index dff6d3019..5f7169dbd 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -1017,7 +1017,9 @@ export async function processRefreshGroup(
     return TaskRunResult.finished();
   }
   // Process refresh sessions of the group in parallel.
-  logger.trace("processing refresh sessions for $ old coins");
+  logger.trace(
+    `processing refresh sessions for ${refreshGroup.oldCoinPubs.length} old 
coins`,
+  );
   let errors: TalerErrorDetail[] = [];
   let inShutdown = false;
   const ps = refreshGroup.oldCoinPubs.map((x, i) =>

-- 
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]