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(){
|
||||
emitLog('Starting pool for ' + options.coin.name + ' [' + options.coin.symbol.toUpperCase() + ']');
|
||||
SetupJobManager();
|
||||
SetupVarDiff();
|
||||
SetupApi();
|
||||
@ -141,13 +140,22 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
return;
|
||||
}
|
||||
|
||||
var portWarnings = [];
|
||||
|
||||
Object.keys(options.ports).forEach(function(port){
|
||||
var portDiff = options.ports[port].diff;
|
||||
if (portDiff > _this.jobManager.currentJob.difficulty)
|
||||
emitWarningLog('Pool difficulty of ' + portDiff + ' on port ' + port +
|
||||
' was set higher than network difficulty of ' + _this.jobManager.currentJob.difficulty);
|
||||
portWarnings.push('port ' + port + ' w/ difficulty ' + portDiff);
|
||||
|
||||
});
|
||||
|
||||
//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();
|
||||
|
||||
});
|
||||
@ -156,13 +164,12 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
|
||||
function OutputPoolInfo(){
|
||||
|
||||
|
||||
var startMessage = 'Stratum Pool Server Started for ' + options.coin.name + ' [' + options.coin.symbol.toUpperCase() + ']';
|
||||
if (process.env.forkId && process.env.forkId !== '0'){
|
||||
emitLog('Pool Server Started');
|
||||
emitLog(startMessage);
|
||||
return;
|
||||
}
|
||||
var infoLines = ['Stratum Pool Server Started...',
|
||||
'Running Coin Pool:\t' + options.coin.name + ' [' + options.coin.symbol.toUpperCase() + ']',
|
||||
var infoLines = [startMessage,
|
||||
'Network Connected:\t' + (options.testnet ? 'Testnet' : 'Live Blockchain'),
|
||||
'Detected Reward Type:\t' + options.coin.reward,
|
||||
'Current Block Height:\t' + _this.jobManager.currentJob.rpcData.height,
|
||||
@ -201,7 +208,9 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
});
|
||||
};
|
||||
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 totalBlocks = peers.sort(function(a, b){
|
||||
return b.startingheight - a.startingheight;
|
||||
return a.startingheight - b.startingheight;
|
||||
})[0].startingheight;
|
||||
|
||||
var percent = (blockCount / totalBlocks * 100).toFixed(2);
|
||||
|
||||
//Only let the first fork show synced status or the log wil look flooded with it
|
||||
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){
|
||||
|
||||
|
||||
//TODO: Convert this all into a batch RPC call for better performance
|
||||
|
||||
|
||||
async.waterfall([
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user