gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (e0ee0e39 -> 5a8931d9)


From: gnunet
Subject: [taler-wallet-core] branch master updated (e0ee0e39 -> 5a8931d9)
Date: Mon, 20 Jul 2020 13:02:51 +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 e0ee0e39 command for confirmPay
     new a2e7f216 editor settings
     new d331f8b8 no more wildcard notifications
     new 4f72f0ab gitignore
     new b18e70c3 remove unnecessary console logging
     new 5a8931d9 add new fields to signatures

The 5 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:
 .gitignore                                 |  2 ++
 .vscode/settings.json                      |  8 +++++++-
 src/crypto/workers/cryptoImplementation.ts |  7 ++++---
 src/operations/errors.ts                   |  3 ---
 src/operations/pay.ts                      |  2 +-
 src/operations/reserves.ts                 |  5 +----
 src/operations/versions.ts                 |  4 ++--
 src/operations/withdraw.ts                 |  5 +++--
 src/types/notifications.ts                 | 31 +++++++++++++++++++++++++-----
 src/wallet.ts                              | 15 +++++++++++++--
 10 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/.gitignore b/.gitignore
index 554c6be6..182fa246 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,5 @@ npm-packages-offline-cache/
 # old folder
 build-scripts/
 
+# Git worktree of pre-built wallet files
+prebuilt/
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7f8edcba..36724f88 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -35,5 +35,11 @@
         "**/*.js.map": true
     },
     "editor.wrappingIndent": "same",
-    "editor.tabSize": 2
+    "editor.tabSize": 2,
+    "search.exclude": {
+        "dist": true,
+        "prebuilt": true,
+        "src/i18n/*.po": true
+    },
+    "search.collapseResults": "auto"
 }
\ No newline at end of file
diff --git a/src/crypto/workers/cryptoImplementation.ts 
b/src/crypto/workers/cryptoImplementation.ts
index e0ba24e4..43def7b6 100644
--- a/src/crypto/workers/cryptoImplementation.ts
+++ b/src/crypto/workers/cryptoImplementation.ts
@@ -72,7 +72,7 @@ import {
 } from "../../util/time";
 
 enum SignaturePurpose {
-  RESERVE_WITHDRAW = 1200,
+  WALLET_RESERVE_WITHDRAW = 1200,
   WALLET_COIN_DEPOSIT = 1201,
   MASTER_DENOMINATION_KEY_VALIDITY = 1025,
   MASTER_WIRE_FEES = 1028,
@@ -160,10 +160,9 @@ export class CryptoImplementation {
     const denomPubHash = hash(denomPub);
     const evHash = hash(ev);
 
-    const withdrawRequest = buildSigPS(SignaturePurpose.RESERVE_WITHDRAW)
+    const withdrawRequest = 
buildSigPS(SignaturePurpose.WALLET_RESERVE_WITHDRAW)
       .put(reservePub)
       .put(amountToBuffer(amountWithFee))
-      .put(amountToBuffer(req.feeWithdraw))
       .put(denomPubHash)
       .put(evHash)
       .build();
@@ -337,6 +336,7 @@ export class CryptoImplementation {
     const d = buildSigPS(SignaturePurpose.WALLET_COIN_DEPOSIT)
       .put(decodeCrock(depositInfo.contractTermsHash))
       .put(decodeCrock(depositInfo.wireInfoHash))
+      .put(hash(decodeCrock(depositInfo.denomPub)))
       .put(timestampRoundedToBuffer(depositInfo.timestamp))
       .put(timestampRoundedToBuffer(depositInfo.refundDeadline))
       .put(amountToBuffer(depositInfo.spendAmount))
@@ -441,6 +441,7 @@ export class CryptoImplementation {
 
     const confirmData = buildSigPS(SignaturePurpose.WALLET_COIN_MELT)
       .put(sessionHash)
+      .put(decodeCrock(meltCoin.denomPubHash))
       .put(amountToBuffer(valueWithFee))
       .put(amountToBuffer(meltFee))
       .put(decodeCrock(meltCoin.coinPub))
diff --git a/src/operations/errors.ts b/src/operations/errors.ts
index 0d180a46..c8885c9e 100644
--- a/src/operations/errors.ts
+++ b/src/operations/errors.ts
@@ -123,7 +123,6 @@ export async function guardOperationException<T>(
   try {
     return await op();
   } catch (e) {
-    console.log("guard: caught exception");
     if (e instanceof OperationFailedAndReportedError) {
       throw e;
     }
@@ -132,7 +131,6 @@ export async function guardOperationException<T>(
       throw new OperationFailedAndReportedError(e.operationError);
     }
     if (e instanceof Error) {
-      console.log("guard: caught Error");
       const opErr = {
         type: "exception",
         message: e.message,
@@ -141,7 +139,6 @@ export async function guardOperationException<T>(
       await onOpError(opErr);
       throw new OperationFailedAndReportedError(opErr);
     }
-    console.log("guard: caught something else");
     const opErr = {
       type: "exception",
       message: "unexpected exception thrown",
diff --git a/src/operations/pay.ts b/src/operations/pay.ts
index 7faace46..a1619074 100644
--- a/src/operations/pay.ts
+++ b/src/operations/pay.ts
@@ -1118,7 +1118,7 @@ export async function refuseProposal(
   );
   if (success) {
     ws.notify({
-      type: NotificationType.Wildcard,
+      type: NotificationType.ProposalRefused,
     });
   }
 }
diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 7dd97dec..365d6e22 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -336,7 +336,7 @@ async function registerReserveWithBank(
     r.retryInfo = initRetryInfo();
     return r;
   });
-  ws.notify({ type: NotificationType.Wildcard });
+  ws.notify({ type: NotificationType.ReserveRegisteredWithBank });
   return processReserveBankStatus(ws, reservePub);
 }
 
@@ -377,8 +377,6 @@ async function processReserveBankStatusImpl(
     await statusResp.json(),
   );
 
-  ws.notify({ type: NotificationType.Wildcard });
-
   if (status.selection_done) {
     if (reserve.reserveStatus === ReserveRecordStatus.REGISTERING_BANK) {
       await registerReserveWithBank(ws, reservePub);
@@ -420,7 +418,6 @@ async function processReserveBankStatusImpl(
     });
     await incrementReserveRetry(ws, reservePub, undefined);
   }
-  ws.notify({ type: NotificationType.Wildcard });
 }
 
 async function incrementReserveRetry(
diff --git a/src/operations/versions.ts b/src/operations/versions.ts
index cfe6ed49..31c4921c 100644
--- a/src/operations/versions.ts
+++ b/src/operations/versions.ts
@@ -19,14 +19,14 @@
  *
  * Uses libtool's current:revision:age versioning.
  */
-export const WALLET_EXCHANGE_PROTOCOL_VERSION = "7:0:0";
+export const WALLET_EXCHANGE_PROTOCOL_VERSION = "8:0:0";
 
 /**
  * Protocol version spoken with the merchant.
  *
  * Uses libtool's current:revision:age versioning.
  */
-export const WALLET_MERCHANT_PROTOCOL_VERSION = "0:0:0";
+export const WALLET_MERCHANT_PROTOCOL_VERSION = "1:0:0";
 
 /**
  * Cache breaker that is appended to queries such as /keys and /wire
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts
index ff618b89..19b470e8 100644
--- a/src/operations/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -489,7 +489,6 @@ export async function selectWithdrawalDenoms(
     }
   } while (selectedDenoms.selectedDenoms.length > 0 && !allValid);
 
-
   if (Amounts.cmp(selectedDenoms.totalWithdrawCost, amount) > 0) {
     throw Error("Bug: withdrawal coin selection is wrong");
   }
@@ -515,7 +514,9 @@ async function incrementWithdrawalRetry(
     wsr.lastError = err;
     await tx.put(Stores.withdrawalGroups, wsr);
   });
-  ws.notify({ type: NotificationType.WithdrawOperationError });
+  if (err) {
+    ws.notify({ type: NotificationType.WithdrawOperationError, error: err });
+  }
 }
 
 export async function processWithdrawGroup(
diff --git a/src/types/notifications.ts b/src/types/notifications.ts
index 3cd5be89..644dfdc8 100644
--- a/src/types/notifications.ts
+++ b/src/types/notifications.ts
@@ -55,7 +55,10 @@ export const enum NotificationType {
   PayOperationError = "pay-error",
   WithdrawOperationError = "withdraw-error",
   ReserveOperationError = "reserve-error",
-  Wildcard = "wildcard",
+  InternalError = "internal-error",
+  PendingOperationProcessed = "pending-operation-processed",
+  ProposalRefused = "proposal-refused",
+  ReserveRegisteredWithBank = "reserve-registered-with-bank",
 }
 
 export interface ProposalAcceptedNotification {
@@ -63,6 +66,12 @@ export interface ProposalAcceptedNotification {
   proposalId: string;
 }
 
+export interface InternalErrorNotification {
+  type: NotificationType.InternalError;
+  message: string;
+  exception: any;
+}
+
 export interface CoinWithdrawnNotification {
   type: NotificationType.CoinWithdrawn;
 }
@@ -167,6 +176,7 @@ export interface TipOperationErrorNotification {
 
 export interface WithdrawOperationErrorNotification {
   type: NotificationType.WithdrawOperationError;
+  error: OperationError,
 }
 
 export interface RecoupOperationErrorNotification {
@@ -182,8 +192,16 @@ export interface ReserveCreatedNotification {
   type: NotificationType.ReserveCreated;
 }
 
-export interface WildcardNotification {
-  type: NotificationType.Wildcard;
+export interface PendingOperationProcessedNotification {
+  type: NotificationType.PendingOperationProcessed;
+}
+
+export interface ProposalRefusedNotification {
+  type: NotificationType.ProposalRefused;
+}
+
+export interface ReserveRegisteredWithBankNotification {
+  type: NotificationType.ReserveRegisteredWithBank;
 }
 
 export type WalletNotification =
@@ -215,5 +233,8 @@ export type WalletNotification =
   | RefundQueriedNotification
   | WithdrawalGroupCreatedNotification
   | CoinWithdrawnNotification
-  | WildcardNotification
-  | RecoupOperationErrorNotification;
+  | RecoupOperationErrorNotification
+  | InternalErrorNotification
+  | PendingOperationProcessedNotification
+  | ProposalRefusedNotification
+  | ReserveRegisteredWithBankNotification;
\ No newline at end of file
diff --git a/src/wallet.ts b/src/wallet.ts
index 5412a0fd..9df27989 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -364,9 +364,20 @@ export class Wallet {
           try {
             await this.processOnePendingOperation(p);
           } catch (e) {
-            console.error(e);
+            if (e instanceof OperationFailedAndReportedError) {
+              logger.warn("operation processed resulted in reported error");
+            } else {
+              console.error("Uncaught exception", e);
+              this.ws.notify({
+                type: NotificationType.InternalError,
+                message: "uncaught exception",
+                exception: e,
+               });
+            }
           }
-          this.ws.notify({ type: NotificationType.Wildcard });
+          this.ws.notify({
+            type: NotificationType.PendingOperationProcessed,
+           });
         }
       }
     }

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