aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/withdraw.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-08-22 16:37:27 +0200
committerFlorian Dold <florian@dold.me>2023-08-22 16:37:27 +0200
commit0a05f6d9030b5a2ce201a98553fa4e6ff13eb907 (patch)
tree75846cdf415443879344e01e38cda7d0cfccdb2c /packages/taler-wallet-core/src/operations/withdraw.ts
parentb9f908db58c43d739e343dda250c5857ec893968 (diff)
downloadwallet-core-0a05f6d9030b5a2ce201a98553fa4e6ff13eb907.tar.xz
wallet-core: always use batch withdrawal
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts55
1 files changed, 0 insertions, 55 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index a1cb29e07..673129928 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -710,12 +710,6 @@ async function processPlanchetGenerate(
}
interface WithdrawalRequestBatchArgs {
- /**
- * Use the batched request on the network level.
- * Not supported by older exchanges.
- */
- useBatchRequest: boolean;
-
coinStartIndex: number;
batchSize: number;
@@ -923,7 +917,6 @@ async function processPlanchetExchangeBatchRequest(
// FIXME: handle individual error codes better!
- if (args.useBatchRequest) {
const reqUrl = new URL(
`reserves/${withdrawalGroup.reservePub}/batch-withdraw`,
withdrawalGroup.exchangeBaseUrl,
@@ -949,53 +942,6 @@ async function processPlanchetExchangeBatchRequest(
coinIdxs: [],
};
}
- } else {
- // We emulate the batch response here by making multiple individual requests
- const responses: ExchangeWithdrawBatchResponse = {
- ev_sigs: [],
- };
- const responseCoinIdxs: number[] = [];
- for (let i = 0; i < batchReq.planchets.length; i++) {
- try {
- const p = batchReq.planchets[i];
- const reqUrl = new URL(
- `reserves/${withdrawalGroup.reservePub}/withdraw`,
- withdrawalGroup.exchangeBaseUrl,
- ).href;
- const resp = await ws.http.fetch(reqUrl, { method: "POST", body: p });
- if (resp.status === HttpStatusCode.UnavailableForLegalReasons) {
- await handleKycRequired(
- ws,
- withdrawalGroup,
- resp,
- i,
- requestCoinIdxs,
- );
- // We still return blinded coins that we could actually withdraw.
- return {
- coinIdxs: responseCoinIdxs,
- batchResp: responses,
- };
- }
- const r = await readSuccessResponseJsonOrThrow(
- resp,
- codecForWithdrawResponse(),
- );
- responses.ev_sigs.push(r);
- responseCoinIdxs.push(requestCoinIdxs[i]);
- } catch (e) {
- if (e instanceof TalerError) {
- logger.warn(`withdrawing planchet failed: ${j2s(e.errorDetail)}`);
- logger.warn(`planchet denom pub hash: ${batchReq.planchets[i].denom_pub_hash}`);
- }
- await storeCoinError(e, requestCoinIdxs[i]);
- }
- }
- return {
- coinIdxs: responseCoinIdxs,
- batchResp: responses,
- };
- }
}
async function processPlanchetVerifyAndStoreCoin(
@@ -1548,7 +1494,6 @@ async function processWithdrawalGroupPendingReady(
const resp = await processPlanchetExchangeBatchRequest(ws, wgContext, {
batchSize: maxBatchSize,
coinStartIndex: i,
- useBatchRequest: ws.config.features.batchWithdrawal,
});
let work: Promise<void>[] = [];
work = [];