diff --git a/backend/src/event-handlers/rollup.js b/backend/src/event-handlers/rollup.js index 395e6a8..dc73620 100644 --- a/backend/src/event-handlers/rollup.js +++ b/backend/src/event-handlers/rollup.js @@ -31,9 +31,7 @@ const stakeRollupAvailability = async () => { const getBatchPostAuthorWeights = async (batchItems_) => { const weights = {}; await Promise.each(batchItems_, async (postId) => { - // TODO: try/catch const post = await read(postId); - // TODO: try/catch const matrixPool = await matrixPools.get(postId); const { fee, result: { votePasses, quorumMet } } = matrixPool; post.authors.forEach(({ authorAddress, weightPPM }) => { @@ -164,7 +162,13 @@ const start = async () => { if (!post.embeddedData?.matrixPools) return false; // Our task here is to check whether the posted result agrees with our own computations - const expectedAuthors = await getBatchPostAuthorWeights(post.embeddedData.matrixPools); + let expectedAuthors; + try { + expectedAuthors = await getBatchPostAuthorWeights(post.embeddedData.matrixPools); + } catch (e) { + console.error('Error calculating batch post author weights', e); + return false; + } return authorsMatch(post.authors, expectedAuthors); });