diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e5e70..4fdc215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.1-alpha.33](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.32...v0.0.1-alpha.33) (2024-09-28) + +### [0.0.1-alpha.32](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.31...v0.0.1-alpha.32) (2024-09-28) + ### [0.0.1-alpha.31](https://github.com/DIG-Network/dig-incentive-server/compare/v0.0.1-alpha.30...v0.0.1-alpha.31) (2024-09-27) diff --git a/package-lock.json b/package-lock.json index ca516e8..d4b700a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dig-incentive-server", - "version": "0.0.1-alpha.31", + "version": "0.0.1-alpha.33", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dig-incentive-server", - "version": "0.0.1-alpha.31", + "version": "0.0.1-alpha.33", "license": "ISC", "dependencies": { "@dignetwork/datalayer-driver": "^0.1.28", diff --git a/package.json b/package.json index b0bc075..7953400 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dig-incentive-server", - "version": "0.0.1-alpha.31", + "version": "0.0.1-alpha.33", "description": "", "type": "commonjs", "main": "./dist/index.js", diff --git a/src/tasks/payouts.ts b/src/tasks/payouts.ts index 8e07d8f..a07bdaa 100644 --- a/src/tasks/payouts.ts +++ b/src/tasks/payouts.ts @@ -6,7 +6,7 @@ import { DigChallenge, DataStore, getStoresList, - Environment + Environment, } from "@dignetwork/dig-sdk"; import { Mutex } from "async-mutex"; import { IncentiveProgram } from "../utils/IncentiveProgram"; @@ -110,21 +110,27 @@ const runIncentiveProgram = async ( console.error( `Failed to connect to peer ${peerIp}: ${error.message}` ); - // await program.addToBlacklist(peerIp); + // await program.addToBlacklist(peerIp); continue; } if (response.success) { const peerGenerationHash = response.headers?.["x-generation-hash"]; - console.log( - `Peer ${peerIp} generation hash: ${peerGenerationHash}, expected: ${rootHash}` - ); + + if (Environment.DEBUG) { + console.log( + `Peer ${peerIp} generation hash: ${peerGenerationHash}, expected: ${rootHash}` + ); + } if (peerGenerationHash === rootHash) { console.log(`Peer ${peerIp} has correct generation hash.`); const challengePromises = randomKeysHex.map(async (hexKey) => { try { - console.log(`Generating challenge for key: ${hexKey}`); + if (Environment.DEBUG) { + console.log(`Generating challenge for key: ${hexKey}`); + } + const digChallenge = new DigChallenge( program.storeId, hexKey, @@ -134,11 +140,13 @@ const runIncentiveProgram = async ( const challenge = await digChallenge.generateChallenge(seed); const serializedChallenge = DigChallenge.serializeChallenge(challenge); - console.log( - `Sending challenge to peer ${peerIp} for key ${hexToUtf8( - hexKey - )}` - ); + if (Environment.DEBUG) { + console.log( + `Sending challenge to peer ${peerIp} for key ${hexToUtf8( + hexKey + )}` + ); + } const peerChallengeResponse = await digPeer.contentServer.getKey( hexToUtf8(hexKey), @@ -147,9 +155,11 @@ const runIncentiveProgram = async ( ); const expectedChallengeResponse = await digChallenge.createChallengeResponse(challenge); - console.log( - `Received response from peer ${peerIp}, expected response: ${expectedChallengeResponse}` - ); + if (Environment.DEBUG) { + console.log( + `Received response from peer ${peerIp}, expected response: ${expectedChallengeResponse}` + ); + } return peerChallengeResponse === expectedChallengeResponse; } catch (error: any) { console.error(