[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fix totally broken withdrawal
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fix totally broken withdrawal coin selection |
Date: |
Thu, 16 Jul 2020 11:44:02 +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 bcd9e2e5 fix totally broken withdrawal coin selection
bcd9e2e5 is described below
commit bcd9e2e5ff7f14308c5298a257388afc398dc674
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Jul 16 15:13:52 2020 +0530
fix totally broken withdrawal coin selection
---
src/operations/withdraw.ts | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts
index fd850f14..41b77da8 100644
--- a/src/operations/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -162,6 +162,9 @@ export async function getBankWithdrawalInfo(
};
}
+/**
+ * Return denominations that can potentially used for a withdrawal.
+ */
async function getPossibleDenoms(
ws: InternalWalletState,
exchangeBaseUrl: string,
@@ -458,24 +461,17 @@ export async function selectWithdrawalDenoms(
throw Error(`exchange ${exchangeBaseUrl} details not available`);
}
- console.log("getting possible denoms");
-
- const possibleDenoms = await getPossibleDenoms(ws, exchange.baseUrl);
-
- console.log("got possible denoms");
-
let allValid = false;
-
let selectedDenoms: DenominationSelectionInfo;
+ // Find a denomination selection for the requested amount.
+ // If a selected denomination has not been validated yet
+ // and turns our to be invalid, we try again with the
+ // reduced set of denominations.
do {
allValid = true;
- const nextPossibleDenoms = [];
- selectedDenoms = getWithdrawDenomList(amount, possibleDenoms);
- console.log("got withdraw denom list");
- if (!selectedDenoms) {
- console;
- }
+ const nextPossibleDenoms = await getPossibleDenoms(ws, exchange.baseUrl);
+ selectedDenoms = getWithdrawDenomList(amount, nextPossibleDenoms);
for (const denomSel of selectedDenoms.selectedDenoms) {
const denom = denomSel.denom;
if (denom.status === DenominationStatus.Unverified) {
@@ -488,17 +484,12 @@ export async function selectWithdrawalDenoms(
allValid = false;
} else {
denom.status = DenominationStatus.VerifiedGood;
- nextPossibleDenoms.push(denom);
}
await ws.db.put(Stores.denominations, denom);
- } else {
- nextPossibleDenoms.push(denom);
}
}
} while (selectedDenoms.selectedDenoms.length > 0 && !allValid);
- console.log("returning denoms");
-
return selectedDenoms;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: fix totally broken withdrawal coin selection,
gnunet <=