Skip to content

Commit

Permalink
Merge pull request VerusCoin#9 from hellcatz/merged_mining
Browse files Browse the repository at this point in the history
Add merged mining compatibility
  • Loading branch information
alexenglish authored May 22, 2023
2 parents 1502f97 + 2c9375f commit 31b6908
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion coins/verustest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sapling": 120,
"txfee": 0.0005,
"requireShielding": true,
"burnFees": true,
"burnFees": false,

"explorer": {
"txURL": "https://explorer.veruscoin.io/tx/",
Expand Down
7 changes: 5 additions & 2 deletions libs/poolWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ 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);

if (!data.blockOnlyPBaaS) {
logger.debug(logSystem, logComponent, logSubCat, 'Block found: ' + data.blockHash + ' [' + data.height + '] by ' + data.worker);
} else {
logger.debug(logSystem, logComponent, logSubCat, 'PBaaS found: ' + data.blockHash + ' by ' + data.worker);
}
if (isValidShare) {
if(data.shareDiff > 1000000000) {
logger.debug(logSystem, logComponent, logSubCat, 'Share was found with diff higher than 1.000.000.000!');
Expand Down
14 changes: 10 additions & 4 deletions libs/shareProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module.exports = function(logger, poolConfig){
var redisCommands = [];

if (isValidShare) {
redisCommands.push(['hincrbyfloat', coin + ':shares:pbaasCurrent', shareData.worker, shareData.difficulty]);
redisCommands.push(['hincrbyfloat', coin + ':shares:roundCurrent', shareData.worker, shareData.difficulty]);
redisCommands.push(['hincrby', coin + ':stats', 'validShares', 1]);
} else {
Expand All @@ -85,10 +86,15 @@ module.exports = function(logger, poolConfig){
redisCommands.push(['zadd', coin + ':hashrate', dateNow / 1000 | 0, hashrateData.join(':')]);

if (isValidBlock){
redisCommands.push(['rename', coin + ':shares:roundCurrent', coin + ':shares:round' + shareData.height]);
redisCommands.push(['rename', coin + ':shares:timesCurrent', coin + ':shares:times' + shareData.height]);
redisCommands.push(['sadd', coin + ':blocksPending', [shareData.blockHash, shareData.txHash, shareData.height, shareData.worker, dateNow].join(':')]);
redisCommands.push(['hincrby', coin + ':stats', 'validBlocks', 1]);
// track potential pbaas blocks ( need lookup and processing )
redisCommands.push(['sadd', coin + ':pbaasPending', [shareData.blockHash, shareData.worker, dateNow].join(':')]);
// track main chain blocks
if (!shareData.blockOnlyPBaaS) {
redisCommands.push(['rename', coin + ':shares:roundCurrent', coin + ':shares:round' + shareData.height]);
redisCommands.push(['rename', coin + ':shares:timesCurrent', coin + ':shares:times' + shareData.height]);
redisCommands.push(['sadd', coin + ':blocksPending', [shareData.blockHash, shareData.txHash, shareData.height, shareData.worker, dateNow].join(':')]);
redisCommands.push(['hincrby', coin + ':stats', 'validBlocks', 1]);
}
}
else if (shareData.blockHash){
redisCommands.push(['hincrby', coin + ':stats', 'invalidBlocks', 1]);
Expand Down

0 comments on commit 31b6908

Please sign in to comment.