Better logging..
This commit is contained in:
parent
c8355ea211
commit
615c1dbfbf
33
lib/pool.js
33
lib/pool.js
@ -112,7 +112,6 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
|
|
||||||
|
|
||||||
this.start = function(){
|
this.start = function(){
|
||||||
emitLog('Starting pool for ' + options.coin.name + ' [' + options.coin.symbol.toUpperCase() + ']');
|
|
||||||
SetupJobManager();
|
SetupJobManager();
|
||||||
SetupVarDiff();
|
SetupVarDiff();
|
||||||
SetupApi();
|
SetupApi();
|
||||||
@ -141,13 +140,22 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var portWarnings = [];
|
||||||
|
|
||||||
Object.keys(options.ports).forEach(function(port){
|
Object.keys(options.ports).forEach(function(port){
|
||||||
var portDiff = options.ports[port].diff;
|
var portDiff = options.ports[port].diff;
|
||||||
if (portDiff > _this.jobManager.currentJob.difficulty)
|
if (portDiff > _this.jobManager.currentJob.difficulty)
|
||||||
emitWarningLog('Pool difficulty of ' + portDiff + ' on port ' + port +
|
portWarnings.push('port ' + port + ' w/ difficulty ' + portDiff);
|
||||||
' was set higher than network difficulty of ' + _this.jobManager.currentJob.difficulty);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Only let the first fork show synced status or the log wil look flooded with it
|
||||||
|
if (portWarnings.length && !process.env.forkId || process.env.forkId === '0') {
|
||||||
|
var warnMessage = 'Network difficulty of ' + _this.jobManager.currentJob.difficulty + ' is lower than '
|
||||||
|
+ portWarnings.join(' and ');
|
||||||
|
emitWarningLog(warnMessage);
|
||||||
|
}
|
||||||
|
|
||||||
finishedCallback();
|
finishedCallback();
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -156,13 +164,12 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
|
|
||||||
function OutputPoolInfo(){
|
function OutputPoolInfo(){
|
||||||
|
|
||||||
|
var startMessage = 'Stratum Pool Server Started for ' + options.coin.name + ' [' + options.coin.symbol.toUpperCase() + ']';
|
||||||
if (process.env.forkId && process.env.forkId !== '0'){
|
if (process.env.forkId && process.env.forkId !== '0'){
|
||||||
emitLog('Pool Server Started');
|
emitLog(startMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var infoLines = ['Stratum Pool Server Started...',
|
var infoLines = [startMessage,
|
||||||
'Running Coin Pool:\t' + options.coin.name + ' [' + options.coin.symbol.toUpperCase() + ']',
|
|
||||||
'Network Connected:\t' + (options.testnet ? 'Testnet' : 'Live Blockchain'),
|
'Network Connected:\t' + (options.testnet ? 'Testnet' : 'Live Blockchain'),
|
||||||
'Detected Reward Type:\t' + options.coin.reward,
|
'Detected Reward Type:\t' + options.coin.reward,
|
||||||
'Current Block Height:\t' + _this.jobManager.currentJob.rpcData.height,
|
'Current Block Height:\t' + _this.jobManager.currentJob.rpcData.height,
|
||||||
@ -201,7 +208,9 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
checkSynced(function(){
|
checkSynced(function(){
|
||||||
emitErrorLog('Daemon is still syncing with network (download blockchain) - server will be started once synced');
|
//Only let the first fork show synced status or the log wil look flooded with it
|
||||||
|
if (!process.env.forkId || process.env.forkId === '0')
|
||||||
|
emitErrorLog('Daemon is still syncing with network (download blockchain) - server will be started once synced');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -217,14 +226,14 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
|
|
||||||
var peers = results[0].response;
|
var peers = results[0].response;
|
||||||
var totalBlocks = peers.sort(function(a, b){
|
var totalBlocks = peers.sort(function(a, b){
|
||||||
return b.startingheight - a.startingheight;
|
return a.startingheight - b.startingheight;
|
||||||
})[0].startingheight;
|
})[0].startingheight;
|
||||||
|
|
||||||
var percent = (blockCount / totalBlocks * 100).toFixed(2);
|
var percent = (blockCount / totalBlocks * 100).toFixed(2);
|
||||||
|
|
||||||
//Only let the first fork show synced status or the log wil look flooded with it
|
//Only let the first fork show synced status or the log wil look flooded with it
|
||||||
if (!process.env.forkId || process.env.forkId === '0')
|
if (!process.env.forkId || process.env.forkId === '0')
|
||||||
emitWarningLog('Downloaded ' + percent + '% of blockchain from network');
|
emitWarningLog('Downloaded ' + percent + '% of blockchain from ' + peers.length + ' peers');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -374,6 +383,10 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
|
|
||||||
function DetectCoinData(finishedCallback){
|
function DetectCoinData(finishedCallback){
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: Convert this all into a batch RPC call for better performance
|
||||||
|
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user