diff options
author | Florian Dold <florian@dold.me> | 2022-09-16 16:20:47 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-16 16:32:21 +0200 |
commit | b91caf977fad8da11e523ca3a39064dd86e04c64 (patch) | |
tree | 732e1543d2555094d7f9a9ca242309847c1a33a3 /packages/taler-wallet-core/src/operations/withdraw.ts | |
parent | 2747bc260bc05418974570d04d7f999dfc988cda (diff) | |
download | wallet-core-b91caf977fad8da11e523ca3a39064dd86e04c64.tar.xz |
wallet-core: support age restrictions in new coin selection
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 11 |
1 files changed, 10 insertions, 1 deletions
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) { |