From a2d4c1e86382b555ef54d10247da92ca6829aa48 Mon Sep 17 00:00:00 2001 From: "Simon.Z" Date: Thu, 23 Mar 2023 16:52:46 -0700 Subject: [PATCH] simplify logs --- libs/poolWorker.js | 2 +- libs/rewardProcessor.js | 32 ++++++++++++++------------------ package-lock.json | 8 ++++---- package.json | 2 +- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/libs/poolWorker.js b/libs/poolWorker.js index 5e2e8dc..18f6623 100644 --- a/libs/poolWorker.js +++ b/libs/poolWorker.js @@ -184,7 +184,7 @@ module.exports = function(logger){ logger.debug(logSystem, logComponent, logSubCat, 'We thought a block was found but it was rejected by the daemon, share data: ' + shareData); else if (isValidBlock) - logger.debug(logSystem, logComponent, logSubCat, 'Block found: ' + data.blockHash + ' by ' + data.worker); + logger.special(logSystem, logComponent, logSubCat, 'Block found: ' + data.blockHash + ' by ' + data.worker); if (isValidShare) { if(data.shareDiff > 1000000000) diff --git a/libs/rewardProcessor.js b/libs/rewardProcessor.js index b0da2ad..e4d6be4 100644 --- a/libs/rewardProcessor.js +++ b/libs/rewardProcessor.js @@ -104,9 +104,7 @@ function SetupForPool(logger, poolOptions, setupFinished) { }, ], function (err) { - console.log("cb: err: ", err); if (err) { - console.log("setup finished", false); setupFinished(false); return; } @@ -134,7 +132,6 @@ function SetupForPool(logger, poolOptions, setupFinished) { } }, processingConfig.rewardInterval * 1000); setTimeout(processRewards, 100); - console.log("setup finished", true); setupFinished(true); } ); @@ -194,7 +191,7 @@ function SetupForPool(logger, poolOptions, setupFinished) { } // calculate worker balances - console.log("workers: ", results[0]); + console.log("balances: ", results[0]); var workers = {}; for (var w in results[0]) { workers[w] = { @@ -287,11 +284,11 @@ function SetupForPool(logger, poolOptions, setupFinished) { ); totalShares += totalSharesInRound; - logger.debug( - logSystem, - logComponent, - `Total shares in round ${round.height}: ${totalSharesInRound}` - ); + // logger.debug( + // logSystem, + // logComponent, + // `Total shares in round ${round.height}: ${totalSharesInRound}` + // ); for (var workerAddress in workerShares) { if (!(workerAddress in pendingShares)) { @@ -308,13 +305,13 @@ function SetupForPool(logger, poolOptions, setupFinished) { } }); - logger.debug( - logSystem, - logComponent, - `Total Shares: ${totalShares}, len(PendingShares): ${ - Object.keys(pendingShares).length - }` - ); + // logger.debug( + // logSystem, + // logComponent, + // `Total Shares: ${totalShares}, len(PendingShares): ${ + // Object.keys(pendingShares).length + // }` + // ); if ("time" in pendingShares) { delete pendingShares["time"]; } @@ -331,7 +328,7 @@ function SetupForPool(logger, poolOptions, setupFinished) { logger.debug( logSystem, logComponent, - `Read balance/reserve and calculate the actual reward for each worker` + `Start to calculate the actual reward for each worker` ); startRPCTimer(); web3.eth.getEnergy(beneficiary, function (err, bal) { @@ -372,7 +369,6 @@ function SetupForPool(logger, poolOptions, setupFinished) { // if actual total reward is not enough for distribute, skip if (actualTotalReward.isLessThanOrEqualTo(0)) { - logger.debug(logSystem, logComponent, "No reward this interval"); return callback(new Error("no reward this interval")); } diff --git a/package-lock.json b/package-lock.json index ada7b2d..4524d8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "ethers": "^5.4.4", "express": "*", "extend": "*", - "meter-stratum-pool": "^0.2.7", + "meter-stratum-pool": "^0.2.12", "meterify": "^1.4.7", "mysql": "*", "node-json-minify": "*", @@ -2671,9 +2671,9 @@ "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" }, "node_modules/meter-stratum-pool": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/meter-stratum-pool/-/meter-stratum-pool-0.2.7.tgz", - "integrity": "sha512-K2NPO1sWxdQ8kNpkiSGjgUVf8e5e/AU74PAjX9U0P1pl96n7dYtCXgeKqxVlRQl40s5g/uTvfC8iRlcYh23Sjw==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/meter-stratum-pool/-/meter-stratum-pool-0.2.12.tgz", + "integrity": "sha512-CM/Z7sq7bc1ayaF+9AsxY2hBPjnr5sUU0yFb0pw/l26Y9aV0kNqD/FHZXScJjo7L9MT4T5g7Q6TAxVOHUmc+/Q==", "dependencies": { "async": "^3.2.4", "bignumber.js": "^9.1.1", diff --git a/package.json b/package.json index 4c9d18e..8e4f390 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "ethers": "^5.4.4", "express": "*", "extend": "*", - "meter-stratum-pool": "^0.2.10", + "meter-stratum-pool": "^0.2.12", "meterify": "^1.4.7", "mysql": "*", "node-json-minify": "*",