diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts b/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts index 33d317c6f..fc7e868dc 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts @@ -125,15 +125,21 @@ async function handlePurseCreationConflict( } const instructedAmount = Amounts.parseOrThrow(peerPushInitiation.amount); + const sel = peerPushInitiation.coinSel; const repair: PeerCoinRepair = { - coinPubs: peerPushInitiation.coinSel.coinPubs, - contribs: peerPushInitiation.coinSel.contributions.map((x) => - Amounts.parseOrThrow(x), - ), + coinPubs: [], + contribs: [], exchangeBaseUrl: peerPushInitiation.exchangeBaseUrl, }; + for (let i = 0; i < sel.coinPubs.length; i++) { + if (sel.coinPubs[i] != brokenCoinPub) { + repair.coinPubs.push(sel.coinPubs[i]); + repair.contribs.push(Amounts.parseOrThrow(sel.contributions[i])); + } + } + const coinSelRes = await selectPeerCoins(ws, { instructedAmount, repair }); if (coinSelRes.type == "failure") { @@ -244,9 +250,10 @@ async function processPeerPushDebitCreateReserve( body: reqBody, }); - const resp = await httpResp.json(); - - logger.info(`resp: ${j2s(resp)}`); + { + const resp = await httpResp.json(); + logger.info(`resp: ${j2s(resp)}`); + } switch (httpResp.status) { case HttpStatusCode.Ok: @@ -258,10 +265,10 @@ async function processPeerPushDebitCreateReserve( } case HttpStatusCode.Conflict: { // Handle double-spending - return handlePurseCreationConflict(ws, peerPushInitiation, resp); + return handlePurseCreationConflict(ws, peerPushInitiation, httpResp); } default: { - const errResp = await readTalerErrorResponse(resp); + const errResp = await readTalerErrorResponse(httpResp); return { type: OperationAttemptResultType.Error, errorDetail: errResp, |