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: fix taler://with


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: fix taler://withdraw-exchange pub key check
Date: Wed, 27 Mar 2024 15:56:47 +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 dac6a052b wallet-core: fix taler://withdraw-exchange pub key check
dac6a052b is described below

commit dac6a052b508cfd208cbf4aa7cb5efc44d85c82a
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Mar 27 15:56:42 2024 +0100

    wallet-core: fix taler://withdraw-exchange pub key check
---
 packages/taler-wallet-core/src/db.ts                  |  2 +-
 packages/taler-wallet-core/src/observable-wrappers.ts | 16 +++++++++++-----
 packages/taler-wallet-core/src/query.ts               | 12 ++++++++++++
 packages/taler-wallet-core/src/shepherd.ts            |  5 +++--
 packages/taler-wallet-core/src/wallet.ts              | 10 +++++-----
 5 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 1d5ff4e7a..aad3b2d7b 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -2999,7 +2999,7 @@ export async function applyFixups(
   db: DbAccess<typeof WalletStoresV1>,
 ): Promise<void> {
   logger.trace("applying fixups");
-  await db.runAllStoresReadWriteTx(async (tx) => {
+  await db.runAllStoresReadWriteTx({}, async (tx) => {
     for (const fixupInstruction of walletDbFixups) {
       logger.trace(`checking fixup ${fixupInstruction.name}`);
       const fixupRecord = await tx.fixups.get(fixupInstruction.name);
diff --git a/packages/taler-wallet-core/src/observable-wrappers.ts 
b/packages/taler-wallet-core/src/observable-wrappers.ts
index 5a8be9cf6..b36f41611 100644
--- a/packages/taler-wallet-core/src/observable-wrappers.ts
+++ b/packages/taler-wallet-core/src/observable-wrappers.ts
@@ -25,7 +25,7 @@ import { IDBDatabase } from "@gnu-taler/idb-bridge";
 import {
   ObservabilityContext,
   ObservabilityEventType,
-  RetryLoopOpts
+  RetryLoopOpts,
 } from "@gnu-taler/taler-util";
 import { TaskIdStr } from "./common.js";
 import { TalerCryptoInterface } from "./index.js";
@@ -44,7 +44,7 @@ export class ObservableTaskScheduler implements TaskScheduler 
{
   constructor(
     private impl: TaskScheduler,
     private oc: ObservabilityContext,
-  ) { }
+  ) {}
 
   private taskDepCache = new Set<string>();
 
@@ -122,12 +122,15 @@ export class ObservableDbAccess<StoreMap> implements 
DbAccess<StoreMap> {
   constructor(
     private impl: DbAccess<StoreMap>,
     private oc: ObservabilityContext,
-  ) { }
+  ) {}
   idbHandle(): IDBDatabase {
     return this.impl.idbHandle();
   }
 
   async runAllStoresReadWriteTx<T>(
+    options: {
+      label?: string;
+    },
     txf: (
       tx: DbReadWriteTransaction<StoreMap, StoreNames<StoreMap>[]>,
     ) => Promise<T>,
@@ -139,7 +142,7 @@ export class ObservableDbAccess<StoreMap> implements 
DbAccess<StoreMap> {
       location,
     });
     try {
-      const ret = await this.impl.runAllStoresReadWriteTx(txf);
+      const ret = await this.impl.runAllStoresReadWriteTx(options, txf);
       this.oc.observe({
         type: ObservabilityEventType.DbQueryFinishSuccess,
         name: "<unknown>",
@@ -157,6 +160,9 @@ export class ObservableDbAccess<StoreMap> implements 
DbAccess<StoreMap> {
   }
 
   async runAllStoresReadOnlyTx<T>(
+    options: {
+      label?: string;
+    },
     txf: (
       tx: DbReadOnlyTransaction<StoreMap, StoreNames<StoreMap>[]>,
     ) => Promise<T>,
@@ -168,7 +174,7 @@ export class ObservableDbAccess<StoreMap> implements 
DbAccess<StoreMap> {
       location,
     });
     try {
-      const ret = await this.impl.runAllStoresReadOnlyTx(txf);
+      const ret = await this.impl.runAllStoresReadOnlyTx(options, txf);
       this.oc.observe({
         type: ObservabilityEventType.DbQueryFinishSuccess,
         name: "<unknown>",
diff --git a/packages/taler-wallet-core/src/query.ts 
b/packages/taler-wallet-core/src/query.ts
index d128805d2..cffad84df 100644
--- a/packages/taler-wallet-core/src/query.ts
+++ b/packages/taler-wallet-core/src/query.ts
@@ -767,11 +767,17 @@ function makeWriteContext(
 export interface DbAccess<StoreMap> {
   idbHandle(): IDBDatabase;
   runAllStoresReadWriteTx<T>(
+    options: {
+      label?: string;
+    },
     txf: (
       tx: DbReadWriteTransaction<StoreMap, Array<StoreNames<StoreMap>>>,
     ) => Promise<T>,
   ): Promise<T>;
   runAllStoresReadOnlyTx<T>(
+    options: {
+      label?: string;
+    },
     txf: (
       tx: DbReadOnlyTransaction<StoreMap, Array<StoreNames<StoreMap>>>,
     ) => Promise<T>,
@@ -802,6 +808,9 @@ export class DbAccessImpl<StoreMap> implements 
DbAccess<StoreMap> {
   }
 
   runAllStoresReadWriteTx<T>(
+    options: {
+      label?: string;
+    },
     txf: (
       tx: DbReadWriteTransaction<StoreMap, Array<StoreNames<StoreMap>>>,
     ) => Promise<T>,
@@ -820,6 +829,9 @@ export class DbAccessImpl<StoreMap> implements 
DbAccess<StoreMap> {
   }
 
   runAllStoresReadOnlyTx<T>(
+    options: {
+      label?: string;
+    },
     txf: (
       tx: DbReadOnlyTransaction<StoreMap, Array<StoreNames<StoreMap>>>,
     ) => Promise<T>,
diff --git a/packages/taler-wallet-core/src/shepherd.ts 
b/packages/taler-wallet-core/src/shepherd.ts
index a54049d7c..f04bcd2c2 100644
--- a/packages/taler-wallet-core/src/shepherd.ts
+++ b/packages/taler-wallet-core/src/shepherd.ts
@@ -286,6 +286,7 @@ export class TaskSchedulerImpl implements TaskScheduler {
 
   async resetTaskRetries(taskId: TaskIdStr): Promise<void> {
     const maybeNotification = await this.ws.db.runAllStoresReadWriteTx(
+      {},
       async (tx) => {
         await tx.operationRetries.delete(taskId);
         return taskToRetryNotification(this.ws, tx, taskId, undefined);
@@ -434,7 +435,7 @@ async function storePendingTaskError(
   e: TalerErrorDetail,
 ): Promise<OperationRetryRecord> {
   logger.info(`storing pending task error for ${pendingTaskId}`);
-  const res = await ws.db.runAllStoresReadWriteTx(async (tx) => {
+  const res = await ws.db.runAllStoresReadWriteTx({}, async (tx) => {
     let retryRecord = await tx.operationRetries.get(pendingTaskId);
     if (!retryRecord) {
       retryRecord = {
@@ -474,7 +475,7 @@ async function storePendingTaskPending(
   ws: InternalWalletState,
   pendingTaskId: string,
 ): Promise<OperationRetryRecord> {
-  const res = await ws.db.runAllStoresReadWriteTx(async (tx) => {
+  const res = await ws.db.runAllStoresReadWriteTx({}, async (tx) => {
     let retryRecord = await tx.operationRetries.get(pendingTaskId);
     let hadError = false;
     if (!retryRecord) {
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index e973f11e4..c203f6648 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -559,7 +559,7 @@ async function createStoredBackup(
   const backup = await exportDb(wex.ws.idb);
   const backupsDb = await openStoredBackupsDatabase(wex.ws.idb);
   const name = `backup-${new Date().getTime()}`;
-  await backupsDb.runAllStoresReadWriteTx(async (tx) => {
+  await backupsDb.runAllStoresReadWriteTx({}, async (tx) => {
     await tx.backupMeta.add({
       name,
     });
@@ -577,7 +577,7 @@ async function listStoredBackups(
     storedBackups: [],
   };
   const backupsDb = await openStoredBackupsDatabase(wex.ws.idb);
-  await backupsDb.runAllStoresReadWriteTx(async (tx) => {
+  await backupsDb.runAllStoresReadWriteTx({}, async (tx) => {
     await tx.backupMeta.iter().forEach((x) => {
       storedBackups.storedBackups.push({
         name: x.name,
@@ -592,7 +592,7 @@ async function deleteStoredBackup(
   req: DeleteStoredBackupRequest,
 ): Promise<void> {
   const backupsDb = await openStoredBackupsDatabase(wex.ws.idb);
-  await backupsDb.runAllStoresReadWriteTx(async (tx) => {
+  await backupsDb.runAllStoresReadWriteTx({}, async (tx) => {
     await tx.backupData.delete(req.name);
     await tx.backupMeta.delete(req.name);
   });
@@ -605,7 +605,7 @@ async function recoverStoredBackup(
   logger.info(`Recovering stored backup ${req.name}`);
   const { name } = req;
   const backupsDb = await openStoredBackupsDatabase(wex.ws.idb);
-  const bd = await backupsDb.runAllStoresReadWriteTx(async (tx) => {
+  const bd = await backupsDb.runAllStoresReadWriteTx({}, async (tx) => {
     const backupMeta = tx.backupMeta.get(name);
     if (!backupMeta) {
       throw Error("backup not found");
@@ -631,7 +631,7 @@ async function handlePrepareWithdrawExchange(
   }
   const exchangeBaseUrl = parsedUri.exchangeBaseUrl;
   const exchange = await fetchFreshExchange(wex, exchangeBaseUrl);
-  if (exchange.masterPub != parsedUri.exchangePub) {
+  if (parsedUri.exchangePub && exchange.masterPub != parsedUri.exchangePub) {
     throw Error("mismatch of exchange master public key (URI vs actual)");
   }
   if (parsedUri.amount) {

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