Skip to content

Commit

Permalink
simplify logs
Browse files Browse the repository at this point in the history
  • Loading branch information
simonzg committed Mar 23, 2023
1 parent e21435e commit a2d4c1e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion libs/poolWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 14 additions & 18 deletions libs/rewardProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -134,7 +132,6 @@ function SetupForPool(logger, poolOptions, setupFinished) {
}
}, processingConfig.rewardInterval * 1000);
setTimeout(processRewards, 100);
console.log("setup finished", true);
setupFinished(true);
}
);
Expand Down Expand Up @@ -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] = {
Expand Down Expand Up @@ -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)) {
Expand All @@ -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"];
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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"));
}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down

0 comments on commit a2d4c1e

Please sign in to comment.