From b91caf977fad8da11e523ca3a39064dd86e04c64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 16 Sep 2022 16:20:47 +0200 Subject: wallet-core: support age restrictions in new coin selection --- packages/taler-wallet-core/src/operations/withdraw.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (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 f2152ccbc..cb0b55faf 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -22,6 +22,7 @@ import { AcceptManualWithdrawalResult, AcceptWithdrawalResponse, addPaytoQueryParams, + AgeRestriction, AmountJson, AmountLike, Amounts, @@ -510,6 +511,7 @@ async function processPlanchetGenerate( withdrawalDone: false, withdrawSig: r.withdrawSig, withdrawalGroupId: withdrawalGroup.withdrawalGroupId, + maxAge: withdrawalGroup.restrictAge ?? AgeRestriction.AGE_UNRESTRICTED, ageCommitmentProof: r.ageCommitmentProof, lastError: undefined, }; @@ -823,6 +825,7 @@ async function processPlanchetVerifyAndStoreCoin( reservePub: planchet.reservePub, withdrawalGroupId: withdrawalGroup.withdrawalGroupId, }, + maxAge: planchet.maxAge, ageCommitmentProof: planchet.ageCommitmentProof, }; @@ -832,7 +835,13 @@ async function processPlanchetVerifyAndStoreCoin( // withdrawal succeeded. If so, mark the withdrawal // group as finished. const firstSuccess = await ws.db - .mktx((x) => [x.coins, x.denominations, x.withdrawalGroups, x.planchets]) + .mktx((x) => [ + x.coins, + x.denominations, + x.coinAvailability, + x.withdrawalGroups, + x.planchets, + ]) .runReadWrite(async (tx) => { const p = await tx.planchets.get(planchetCoinPub); if (!p || p.withdrawalDone) { -- cgit v1.2.3