diff options
author | Florian Dold <florian@dold.me> | 2021-06-22 18:43:11 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-22 18:43:11 +0200 |
commit | 09d1dd83ec1bf9ca16841d0afb18b9a7da705bcb (patch) | |
tree | af089d994c233888f3f7291fdc148a44142296ed /packages/taler-wallet-core/src/operations/deposits.ts | |
parent | 39c4b42dafc5d8fc5f455e7ed936c45ec2340cfc (diff) | |
download | wallet-core-09d1dd83ec1bf9ca16841d0afb18b9a7da705bcb.tar.gz wallet-core-09d1dd83ec1bf9ca16841d0afb18b9a7da705bcb.tar.bz2 wallet-core-09d1dd83ec1bf9ca16841d0afb18b9a7da705bcb.zip |
prevent conflicting coin allocation with concurrent payments
Diffstat (limited to 'packages/taler-wallet-core/src/operations/deposits.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/deposits.ts | 12 |
1 files changed, 9 insertions, 3 deletions
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); }); |