gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 01/03: create planchets only in one place


From: gnunet
Subject: [taler-wallet-core] 01/03: create planchets only in one place
Date: Mon, 11 May 2020 18:17:44 +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 d7ee78669d4ab25f5f883cc3858ccba4e409c354
Author: Florian Dold <address@hidden>
AuthorDate: Mon May 11 20:51:45 2020 +0530

    create planchets only in one place
---
 src/operations/reserves.ts | 37 -------------------------------------
 src/operations/withdraw.ts |  1 +
 2 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 786f4f51..a3c6d56a 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -647,40 +647,6 @@ async function depleteReserve(
 
   const withdrawalGroupId = encodeCrock(randomBytes(32));
 
-  const planchets: PlanchetRecord[] = [];
-  let coinIdx = 0;
-  for (let i = 0; i < denomsForWithdraw.selectedDenoms.length; i++) {
-    const d = denomsForWithdraw.selectedDenoms[i];
-    const denom = d.denom;
-    for (let j = 0; j < d.count; j++) {
-      const r = await ws.cryptoApi.createPlanchet({
-        denomPub: denom.denomPub,
-        feeWithdraw: denom.feeWithdraw,
-        reservePriv: reserve.reservePriv,
-        reservePub: reserve.reservePub,
-        value: denom.value,
-      });
-      const planchet: PlanchetRecord = {
-        blindingKey: r.blindingKey,
-        coinEv: r.coinEv,
-        coinEvHash: r.coinEvHash,
-        coinIdx,
-        coinPriv: r.coinPriv,
-        coinPub: r.coinPub,
-        coinValue: r.coinValue,
-        denomPub: r.denomPub,
-        denomPubHash: r.denomPubHash,
-        isFromTip: false,
-        reservePub: r.reservePub,
-        withdrawalDone: false,
-        withdrawSig: r.withdrawSig,
-        withdrawalGroupId: withdrawalGroupId,
-      };
-      planchets.push(planchet);
-      coinIdx++;
-    }
-  }
-
   logger.trace("created plachets");
 
   const withdrawalRecord: WithdrawalGroupRecord = {
@@ -747,9 +713,6 @@ async function depleteReserve(
       newReserve.retryInfo = initRetryInfo(false);
       await tx.put(Stores.reserves, newReserve);
       await tx.put(Stores.withdrawalGroups, withdrawalRecord);
-      for (const p of planchets) {
-        await tx.put(Stores.planchets, p);
-      }
       return true;
     },
   );
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts
index b89dac77..91e4ff1d 100644
--- a/src/operations/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -522,6 +522,7 @@ async function processInBatches(workGen: 
Iterator<Promise<void>>, batchSize: num
     if (batch.length == 0) {
       break;
     }
+    logger.trace(`processing withdrawal batch of ${batch.length} elements`);
     await Promise.all(batch);
   }
 }

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



reply via email to

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