diff --git a/chaincode/src/allowances/checkAllowances.ts b/chaincode/src/allowances/checkAllowances.ts index 0b3a6a1a0f..b9b53bc7f6 100644 --- a/chaincode/src/allowances/checkAllowances.ts +++ b/chaincode/src/allowances/checkAllowances.ts @@ -96,7 +96,6 @@ export async function checkAllowances( action: AllowanceType, callingOnBehalf: string ): Promise { - // Sum the quantity applicable let totalAllowance: BigNumber = new BigNumber(0); const validAllowances = await cleanAllowances(ctx, applicableAllowances, callingOnBehalf); @@ -104,7 +103,7 @@ export async function checkAllowances( validAllowances.forEach((allowance: TokenAllowance) => { // Check if the token instance matches // Check if the action matches - // Check if the swap has expired + // Check if allowance is expired if ( allowance.collection === tokenInstanceKey.collection && allowance.category === tokenInstanceKey.category && @@ -112,7 +111,7 @@ export async function checkAllowances( allowance.additionalKey === tokenInstanceKey.additionalKey && allowance.instance.isEqualTo(tokenInstanceKey.instance) && allowance.allowanceType === action && - (allowance.expires === 0 || (allowance.expires && allowance.expires >= ctx.txUnixTime)) + (allowance.expires === 0 || isAllowanceExpired(ctx, allowance)) ) { totalAllowance = totalAllowance.plus(allowance.quantity).minus(allowance.quantitySpent); }