From 71e12724b7f1885a3951cddfcbd1dac172eeb677 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Sun, 29 Oct 2023 07:56:48 -0400 Subject: [PATCH] feat: sync fix by looking at timestamps instead of hashes --- src/tasks/sync-audit-table.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tasks/sync-audit-table.js b/src/tasks/sync-audit-table.js index beae8776..74cc9f93 100644 --- a/src/tasks/sync-audit-table.js +++ b/src/tasks/sync-audit-table.js @@ -221,11 +221,13 @@ const syncOrganizationAudit = async (organization) => { raw: true, }); - // There was an oversight in the audit model where we named it onChainConfirmationTimeStamp but - // the RPC result calls in timestamp. This is a temporary fix to ensure that we can still sync - lastRootSaved.timestamp = Number( - lastRootSaved.onchainConfirmationTimeStamp, - ); + if (lastRootSaved) { + // There was an oversight in the audit model where we named it onChainConfirmationTimeStamp but + // the RPC result calls in timestamp. This is a temporary fix to ensure that we can still sync + lastRootSaved.timestamp = Number( + lastRootSaved?.onchainConfirmationTimeStamp || 0, + ); + } } let generation = _.get(rootHistory, '[0]');