check age mask before

This commit is contained in:
Sebastian 2022-09-20 20:14:46 -03:00
parent 16a5bb4083
commit 415874fdfb
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1

View File

@ -262,7 +262,7 @@ export function selectWithdrawalDenominations(
DenominationRecord.getValue(d), DenominationRecord.getValue(d),
d.fees.feeWithdraw, d.fees.feeWithdraw,
).amount; ).amount;
for (;;) { for (; ;) {
if (Amounts.cmp(remaining, cost) < 0) { if (Amounts.cmp(remaining, cost) < 0) {
break; break;
} }
@ -904,8 +904,7 @@ export async function updateWithdrawalDenoms(
denom.verificationStatus === DenominationVerificationStatus.Unverified denom.verificationStatus === DenominationVerificationStatus.Unverified
) { ) {
logger.trace( logger.trace(
`Validating denomination (${current + 1}/${ `Validating denomination (${current + 1}/${denominations.length
denominations.length
}) signature of ${denom.denomPubHash}`, }) signature of ${denom.denomPubHash}`,
); );
let valid = false; let valid = false;
@ -988,7 +987,7 @@ async function queryReserve(
if ( if (
resp.status === 404 && resp.status === 404 &&
result.talerErrorResponse.code === result.talerErrorResponse.code ===
TalerErrorCode.EXCHANGE_RESERVES_STATUS_UNKNOWN TalerErrorCode.EXCHANGE_RESERVES_STATUS_UNKNOWN
) { ) {
ws.notify({ ws.notify({
type: NotificationType.ReserveNotYetFound, type: NotificationType.ReserveNotYetFound,
@ -1270,6 +1269,8 @@ export async function getExchangeWithdrawalInfo(
return ws.getDenomInfo(ws, tx, exchangeBaseUrl, ds.denomPubHash); return ws.getDenomInfo(ws, tx, exchangeBaseUrl, ds.denomPubHash);
}); });
checkDbInvariant(!!denom); checkDbInvariant(!!denom);
hasDenomWithAgeRestriction =
hasDenomWithAgeRestriction || denom.denomPub.age_mask > 0;
const expireDeposit = denom.stampExpireDeposit; const expireDeposit = denom.stampExpireDeposit;
if (!earliestDepositExpiration) { if (!earliestDepositExpiration) {
earliestDepositExpiration = expireDeposit; earliestDepositExpiration = expireDeposit;
@ -1283,8 +1284,6 @@ export async function getExchangeWithdrawalInfo(
) { ) {
earliestDepositExpiration = expireDeposit; earliestDepositExpiration = expireDeposit;
} }
hasDenomWithAgeRestriction =
hasDenomWithAgeRestriction || denom.denomPub.age_mask > 0;
} }
checkLogicInvariant(!!earliestDepositExpiration); checkLogicInvariant(!!earliestDepositExpiration);
@ -1312,7 +1311,7 @@ export async function getExchangeWithdrawalInfo(
) { ) {
logger.warn( logger.warn(
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` + `wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
`(exchange has ${exchangeDetails.protocolVersion}), checking for updates`, `(exchange has ${exchangeDetails.protocolVersion}), checking for updates`,
); );
} }
} }