wallet-core: fix mixed age restrictions

This commit is contained in:
Florian Dold 2022-09-16 17:51:07 +02:00
parent 117baf0e5b
commit 4b72bbd017
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -675,13 +675,8 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
let maybeAcp: AgeCommitmentProof | undefined = undefined;
let maybeAgeCommitmentHash: string | undefined = undefined;
if (req.restrictAge || denomPub.age_mask) {
if (req.restrictAge && denomPub.age_mask === 0) {
throw Error(
"requested age restriction for a denomination that does not support age restriction",
);
}
const age = req.restrictAge || 32;
if (denomPub.age_mask) {
const age = req.restrictAge || AgeRestriction.AGE_UNRESTRICTED;
logger.info(`creating age-restricted planchet (age ${age})`);
maybeAcp = await AgeRestriction.restrictionCommit(
denomPub.age_mask,