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 creation of


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: fix creation of refresh session after peer-{push,pull}
Date: Mon, 12 Sep 2022 20:52:07 +0200

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 b645d793 wallet-core: fix creation of refresh session after 
peer-{push,pull}
b645d793 is described below

commit b645d793df330d61c719e56acb96d7feebef4b21
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Sep 12 20:52:01 2022 +0200

    wallet-core: fix creation of refresh session after peer-{push,pull}
---
 packages/taler-util/src/walletTypes.ts                     |  4 +++-
 packages/taler-wallet-core/src/operations/backup/import.ts |  2 +-
 packages/taler-wallet-core/src/operations/pay.ts           |  2 +-
 packages/taler-wallet-core/src/operations/peer-to-peer.ts  | 10 +++++++---
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/packages/taler-util/src/walletTypes.ts 
b/packages/taler-util/src/walletTypes.ts
index 43570c44..a993f29a 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -523,7 +523,9 @@ export interface PlanchetCreationRequest {
  */
 export enum RefreshReason {
   Manual = "manual",
-  Pay = "pay",
+  PayMerchant = "pay-merchant",
+  PayPeerPush = "pay-peer-push",
+  PayPeerPull = "pay-peer-pull",
   Refund = "refund",
   AbortPay = "abort-pay",
   Recoup = "recoup",
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts 
b/packages/taler-wallet-core/src/operations/backup/import.ts
index 57d7449e..ff7ff0d0 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -810,7 +810,7 @@ export async function importBackup(
               reason = RefreshReason.Manual;
               break;
             case BackupRefreshReason.Pay:
-              reason = RefreshReason.Pay;
+              reason = RefreshReason.PayMerchant;
               break;
             case BackupRefreshReason.Recoup:
               reason = RefreshReason.Recoup;
diff --git a/packages/taler-wallet-core/src/operations/pay.ts 
b/packages/taler-wallet-core/src/operations/pay.ts
index 8193bf86..3d4d2b5a 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -409,7 +409,7 @@ export async function applyCoinSpend(
   const refreshCoinPubs = coinSelection.coinPubs.map((x) => ({
     coinPub: x,
   }));
-  await createRefreshGroup(ws, tx, refreshCoinPubs, RefreshReason.Pay);
+  await createRefreshGroup(ws, tx, refreshCoinPubs, RefreshReason.PayMerchant);
 }
 
 /**
diff --git a/packages/taler-wallet-core/src/operations/peer-to-peer.ts 
b/packages/taler-wallet-core/src/operations/peer-to-peer.ts
index 965dfd8e..9ce460ad 100644
--- a/packages/taler-wallet-core/src/operations/peer-to-peer.ts
+++ b/packages/taler-wallet-core/src/operations/peer-to-peer.ts
@@ -214,7 +214,6 @@ export async function initiatePeerToPeerPush(
   ws: InternalWalletState,
   req: InitiatePeerPushPaymentRequest,
 ): Promise<InitiatePeerPushPaymentResponse> {
-  // FIXME: actually create a record for retries here!
   const instructedAmount = Amounts.parseOrThrow(req.amount);
 
   const pursePair = await ws.cryptoApi.createEddsaKeypair({});
@@ -265,6 +264,7 @@ export async function initiatePeerToPeerPush(
           Amounts.parseOrThrow(c.contribution),
         ).amount;
         coin.status = CoinStatus.Dormant;
+        pubs.push({ coinPub: coin.coinPub });
         await tx.coins.put(coin);
       }
 
@@ -283,7 +283,7 @@ export async function initiatePeerToPeerPush(
         timestampCreated: TalerProtocolTimestamp.now(),
       });
 
-      await createRefreshGroup(ws, tx, pubs, RefreshReason.Pay);
+      await createRefreshGroup(ws, tx, pubs, RefreshReason.PayPeerPush);
 
       return sel;
     });
@@ -601,10 +601,11 @@ export async function acceptPeerPullPayment(
           Amounts.parseOrThrow(c.contribution),
         ).amount;
         coin.status = CoinStatus.Dormant;
+        pubs.push({ coinPub: coin.coinPub });
         await tx.coins.put(coin);
       }
 
-      await createRefreshGroup(ws, tx, pubs, RefreshReason.Pay);
+      await createRefreshGroup(ws, tx, pubs, RefreshReason.PayPeerPull);
 
       const pi = await tx.peerPullPaymentIncoming.get(
         req.peerPullPaymentIncomingId,
@@ -711,6 +712,9 @@ export async function checkPeerPullPayment(
   };
 }
 
+/**
+ * Initiate a peer pull payment.
+ */
 export async function initiatePeerRequestForPay(
   ws: InternalWalletState,
   req: InitiatePeerPullPaymentRequest,

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