gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-wallet-core] 03/03: fix error in index iteration


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-core] 03/03: fix error in index iteration
Date: Sun, 01 Sep 2019 01:05:47 +0200

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

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

commit 70912b07250e7c86ace4a0b0b16e90352df93ece
Author: Florian Dold <address@hidden>
AuthorDate: Sun Sep 1 01:05:38 2019 +0200

    fix error in index iteration
---
 bin/taler-wallet-cli                     |  1 +
 packages/idb-bridge/package.json         |  2 +-
 packages/idb-bridge/src/MemoryBackend.ts |  1 +
 src/android/index.ts                     | 10 ++++++++++
 src/headless/helpers.ts                  |  3 ++-
 src/headless/taler-wallet-cli.ts         |  2 +-
 src/query.ts                             |  6 +++++-
 src/wallet.ts                            |  6 +++---
 8 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/bin/taler-wallet-cli b/bin/taler-wallet-cli
index 1dbf05a0..04aef892 100755
--- a/bin/taler-wallet-cli
+++ b/bin/taler-wallet-cli
@@ -1,2 +1,3 @@
 #!/usr/bin/env node
+require('source-map-support').install();
 require('../dist/node/headless/taler-wallet-cli.js')
diff --git a/packages/idb-bridge/package.json b/packages/idb-bridge/package.json
index b8579b05..f0072a6b 100644
--- a/packages/idb-bridge/package.json
+++ b/packages/idb-bridge/package.json
@@ -1,6 +1,6 @@
 {
   "name": "idb-bridge",
-  "version": "0.0.9",
+  "version": "0.0.10",
   "description": "IndexedDB implementation that uses SQLite3 as storage",
   "main": "./build/index.js",
   "types": "./build/index.d.ts",
diff --git a/packages/idb-bridge/src/MemoryBackend.ts 
b/packages/idb-bridge/src/MemoryBackend.ts
index 44da137f..99582a1b 100644
--- a/packages/idb-bridge/src/MemoryBackend.ts
+++ b/packages/idb-bridge/src/MemoryBackend.ts
@@ -1156,6 +1156,7 @@ export class MemoryBackend implements Backend {
             indexPos = res[1].indexKey;
             indexEntry = res[1];
             primkeySubPos = forward ? 0 : indexEntry.primaryKeys.length - 1;
+            continue;
           } else {
             break;
           }
diff --git a/src/android/index.ts b/src/android/index.ts
index e7d24c8b..d3f5cd0d 100644
--- a/src/android/index.ts
+++ b/src/android/index.ts
@@ -171,6 +171,16 @@ export function installAndroidWalletListener() {
         httpLib.handleTunnelResponse(msg.args);
         break;
       }
+      case "getWithdrawalInfo": {
+        const wallet = await wp.promise;
+        result = await wallet.getWithdrawalInfo(msg.args.talerWithdrawUri);
+        break;
+      }
+      case "acceptWithdrawal": {
+        const wallet = await wp.promise;
+        result = await wallet.acceptWithdrawal(msg.args.talerWithdrawUri, 
msg.args.selectedExchange);
+        break;
+      }
       case "reset": {
         const wallet = await wp.promise;
         wallet.stop();
diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts
index a86b2673..6716ccef 100644
--- a/src/headless/helpers.ts
+++ b/src/headless/helpers.ts
@@ -133,8 +133,9 @@ export async function getDefaultNodeWallet(
 
   const myBadge = new ConsoleBadge();
 
+  BridgeIDBFactory.enableTracing = true;
   const myBackend = new MemoryBackend();
-  myBackend.enableTracing = false;
+  myBackend.enableTracing = true;
 
   const storagePath = args.persistentStoragePath;
   if (storagePath) {
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index bfa1ac4b..da68f46a 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -135,7 +135,7 @@ program
       persistentStoragePath: walletDbPath,
     });
 
-    const withdrawInfo = await wallet.downloadWithdrawInfo(withdrawUrl);
+    const withdrawInfo = await wallet.getWithdrawalInfo(withdrawUrl);
 
     console.log("withdraw info", withdrawInfo);
 
diff --git a/src/query.ts b/src/query.ts
index 7308d9ed..76669687 100644
--- a/src/query.ts
+++ b/src/query.ts
@@ -21,6 +21,7 @@
  */
 
  import { openPromise } from "./promiseUtils";
+import { join } from "path";
 
 /**
  * Result of an inner join.
@@ -463,11 +464,14 @@ class QueryStreamIndexJoin<T, S> extends 
QueryStreamBase<JoinResult<T, S>> {
         f(true, undefined, tx);
         return;
       }
+      const joinKey = this.key(value);
+      console.log("***** JOINING ON", joinKey);
       const s = tx.objectStore(this.storeName).index(this.indexName);
-      const req = s.openCursor(IDBKeyRange.only(this.key(value)));
+      const req = s.openCursor(IDBKeyRange.only(joinKey));
       req.onsuccess = () => {
         const cursor = req.result;
         if (cursor) {
+          console.log(`join result for ${joinKey}`, { left: value, right: 
cursor.value });
           f(false, { left: value, right: cursor.value }, tx);
           cursor.continue();
         }
diff --git a/src/wallet.ts b/src/wallet.ts
index 3785f912..1d231f2d 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -1822,7 +1822,7 @@ export class Wallet {
     talerWithdrawUri: string,
     maybeSelectedExchange?: string,
   ): Promise<WithdrawDetails> {
-    const info = await this.downloadWithdrawInfo(talerWithdrawUri);
+    const info = await this.getWithdrawalInfo(talerWithdrawUri);
     let rci: ReserveCreationInfo | undefined = undefined;
     if (maybeSelectedExchange) {
       rci = await this.getWithdrawDetailsForAmount(
@@ -3551,7 +3551,7 @@ export class Wallet {
     // strategy to test it.
   }
 
-  async downloadWithdrawInfo(
+  async getWithdrawalInfo(
     talerWithdrawUri: string,
   ): Promise<DownloadedWithdrawInfo> {
     const uriResult = parseWithdrawUri(talerWithdrawUri);
@@ -3577,7 +3577,7 @@ export class Wallet {
     talerWithdrawUri: string,
     selectedExchange: string,
   ): Promise<AcceptWithdrawalResponse> {
-    const withdrawInfo = await this.downloadWithdrawInfo(talerWithdrawUri);
+    const withdrawInfo = await this.getWithdrawalInfo(talerWithdrawUri);
     const exchangeWire = await this.getExchangePaytoUri(
       selectedExchange,
       withdrawInfo.wireTypes,

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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