From 09d1dd83ec1bf9ca16841d0afb18b9a7da705bcb Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 22 Jun 2021 18:43:11 +0200 Subject: prevent conflicting coin allocation with concurrent payments --- packages/taler-wallet-core/src/operations/deposits.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/deposits.ts') diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 9dee7557c..c788a9ea2 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -36,7 +36,7 @@ import { timestampTruncateToSecond, TrackDepositGroupRequest, TrackDepositGroupResponse, - URL + URL, } from "@gnu-taler/taler-util"; import { InternalWalletState } from "../common.js"; import { kdf } from "../crypto/primitives/kdf.js"; @@ -433,7 +433,8 @@ export async function createDepositGroup( timestampCreated: timestamp, timestampFinished: undefined, payCoinSelection: payCoinSel, - depositedPerCoin: payCoinSel.coinPubs.map((x) => false), + payCoinSelectionUid: encodeCrock(getRandomBytes(32)), + depositedPerCoin: payCoinSel.coinPubs.map(() => false), merchantPriv: merchantPair.priv, merchantPub: merchantPair.pub, totalPayCost: totalDepositCost, @@ -454,7 +455,12 @@ export async function createDepositGroup( denominations: x.denominations, })) .runReadWrite(async (tx) => { - await applyCoinSpend(ws, tx, payCoinSel); + await applyCoinSpend( + ws, + tx, + payCoinSel, + `deposit-group:${depositGroup.depositGroupId}`, + ); await tx.depositGroups.put(depositGroup); }); -- cgit v1.2.3