Remove legacy child-pool merge mining layer
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 36s

This commit is contained in:
Codex Bot
2026-03-21 19:06:14 +01:00
parent 141e91909a
commit e20b6433ba
17 changed files with 108 additions and 1069 deletions

69
init.js
View File

@@ -39,11 +39,6 @@
auth_pass: config.redis.auth
});
if ((typeof config.poolServer.mergedMining !== 'undefined' && config.poolServer.mergedMining) && typeof config.childPools !== 'undefined')
config.childPools = config.childPools.filter(pool => pool.enabled);
else
config.childPools = [];
// Load pool modules
if (cluster.isWorker) {
switch (process.env.workerType) {
@@ -53,9 +48,6 @@
case 'daemon':
require('./lib/daemon.js')
break
case 'childDaemon':
require('./lib/childDaemon.js')
break
case 'blockUnlocker':
require('./lib/blockUnlocker.js');
break;
@@ -129,8 +121,6 @@
} else {
spawnPoolWorkers();
spawnDaemon();
if (config.poolServer.mergedMining)
spawnChildDaemons();
spawnBlockUnlocker();
spawnPaymentProcessor();
spawnApi();
@@ -238,65 +228,6 @@
}, 10);
}
/**
* Spawn pool workers module
**/
function spawnChildDaemons () {
if (!config.poolServer || !config.poolServer.enabled || !config.poolServer.ports || config.poolServer.ports.length === 0) return;
if (config.poolServer.ports.length === 0) {
log('error', logSystem, 'Pool server enabled but no ports specified');
return;
}
let numForks = config.childPools.length;
if (numForks === 0) return;
var daemonWorkers = {};
var createDaemonWorker = function (poolId) {
var worker = cluster.fork({
workerType: 'childDaemon',
poolId: poolId
});
worker.poolId = poolId;
worker.type = 'childDaemon';
daemonWorkers[poolId] = worker;
worker.on('exit', function (code, signal) {
log('error', logSystem, 'Child Daemon fork %s died, spawning replacement worker...', [poolId]);
setTimeout(function () {
createDaemonWorker(poolId);
}, 2000);
})
.on('message', function (msg) {
switch (msg.type) {
case 'ChildBlockTemplate':
Object.keys(cluster.workers)
.forEach(function (id) {
if (cluster.workers[id].type === 'pool') {
cluster.workers[id].send({
type: 'ChildBlockTemplate',
block: msg.block,
poolIndex: msg.poolIndex
});
}
});
break;
}
});
};
var i = 0;
var spawnInterval = setInterval(function () {
createDaemonWorker(i.toString())
i++
if (i === numForks) {
clearInterval(spawnInterval);
log('info', logSystem, 'Child Daemon spawned on %d thread(s)', [numForks]);
}
}, 10);
}
/**
* Spawn daemon module
**/