Skip to content

Commit

Permalink
Fix app receipt validation logic: ensure invalid appReceiptData resul…
Browse files Browse the repository at this point in the history
…ts in correct validation state and update comments for clarity.
  • Loading branch information
S0naliThakur committed Dec 23, 2024
1 parent 098faba commit a2cba2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/shardeum/verifyAppReceiptData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const verifyAppReceiptData = async (
} else result = { valid: true, needToSave: true }

if (!validateAppReceiptData(appReceiptData, failedReasons, nestedCounterMessages)) {
result = { valid: false, needToSave: false }
return result
}

Expand Down Expand Up @@ -152,6 +153,7 @@ const validateAppReceiptData = (appReceiptData: any, failedReasons = [], nestedC
}
}

// Use validateAppReceiptData to ensure appReceiptData is valid before calculating its hash with calculateAppReceiptDataHash
const calculateAppReceiptDataHash = (appReceiptData: any): string => {
return crypto.hashObj(appReceiptData)
}

0 comments on commit a2cba2e

Please sign in to comment.