diff --git a/backend/src/api/import-from-ss.js b/backend/src/api/import-from-ss.js index 0f5d12b..7d81d90 100644 --- a/backend/src/api/import-from-ss.js +++ b/backend/src/api/import-from-ss.js @@ -3,6 +3,7 @@ const ethers = require('ethers'); const crypto = require('crypto'); const Promise = require('bluebird'); +const objectHash = require('object-hash'); const { authorAddresses, authorPrivKeys } = require('../util/db'); const { dao } = require('../util/contracts'); const write = require('./write'); @@ -144,9 +145,10 @@ const importPaper = async (paper) => { // The forum allows dangling citations to support this use case. try { const citedPost = await generatePost(citedPaper); + const citedPostHash = objectHash(citedPost); return { weightPPM: eachCitationWeightPercent, - targetPostId: citedPost.hash, + targetPostId: citedPostHash, }; } catch (e) { return null; @@ -171,6 +173,7 @@ const importPaper = async (paper) => { }); // Add the post to the forum (on-chain) + console.log('addPostWithRetry', { authors, hash, citations }); const { alreadyAdded } = await addPostWithRetry(authors, hash, citations); if (alreadyAdded) { console.log(`Post already added for paper ${paperId}`);