gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 03/03: abort exchange update if version does not mat


From: gnunet
Subject: [taler-wallet-core] 03/03: abort exchange update if version does not match
Date: Mon, 09 Mar 2020 09:59:23 +0100

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

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

commit bf1b350d4410cfc7c3e9ae3a717343c9ef19625a
Author: Florian Dold <address@hidden>
AuthorDate: Mon Mar 9 14:29:13 2020 +0530

    abort exchange update if version does not match
---
 src/operations/exchanges.ts | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/operations/exchanges.ts b/src/operations/exchanges.ts
index ca8c94ec..89f89ec1 100644
--- a/src/operations/exchanges.ts
+++ b/src/operations/exchanges.ts
@@ -39,8 +39,12 @@ import {
   OperationFailedAndReportedError,
   guardOperationException,
 } from "./errors";
-import { WALLET_CACHE_BREAKER_CLIENT_VERSION } from "./versions";
+import {
+  WALLET_CACHE_BREAKER_CLIENT_VERSION,
+  WALLET_EXCHANGE_PROTOCOL_VERSION,
+} from "./versions";
 import { getTimestampNow } from "../util/time";
+import { compare } from "../util/libtoolVersion";
 
 async function denominationRecordFromKeys(
   ws: InternalWalletState,
@@ -161,6 +165,20 @@ async function updateExchangeWithKeys(
     throw new OperationFailedAndReportedError(m);
   }
 
+  const versionRes = compare(WALLET_EXCHANGE_PROTOCOL_VERSION, 
protocolVersion);
+  if (versionRes?.compatible != true) {
+    const m = "exchange protocol version not compatible with wallet";
+    await setExchangeError(ws, baseUrl, {
+      type: "protocol-incompatible",
+      details: {
+        exchangeProtocolVersion: protocolVersion,
+        walletProtocolVersion: WALLET_EXCHANGE_PROTOCOL_VERSION,
+      },
+      message: m,
+    });
+    throw new OperationFailedAndReportedError(m);
+  }
+
   const currency = Amounts.parseOrThrow(exchangeKeysJson.denoms[0].value)
     .currency;
 

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



reply via email to

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