From a2cba2e7521acb79a8e3ef5d43d1478c80f8eb74 Mon Sep 17 00:00:00 2001 From: Sonali Thakur Date: Mon, 23 Dec 2024 12:07:23 +0530 Subject: [PATCH] Fix app receipt validation logic: ensure invalid appReceiptData results in correct validation state and update comments for clarity. --- src/shardeum/verifyAppReceiptData.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shardeum/verifyAppReceiptData.ts b/src/shardeum/verifyAppReceiptData.ts index e6de550..1cbdb0d 100644 --- a/src/shardeum/verifyAppReceiptData.ts +++ b/src/shardeum/verifyAppReceiptData.ts @@ -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 } @@ -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) } \ No newline at end of file