From 0a05f6d9030b5a2ce201a98553fa4e6ff13eb907 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 22 Aug 2023 16:37:27 +0200 Subject: wallet-core: always use batch withdrawal --- .../taler-wallet-core/src/operations/withdraw.ts | 55 ---------------------- 1 file changed, 55 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts') 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[] = []; work = []; -- cgit v1.2.3