From f84ee142c243f513f77e51bb1aec1c5ea74d7401 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Thu, 29 May 2014 14:46:37 -0600 Subject: [PATCH 01/16] Share merging features --- init.js | 20 ++++++++++++++++++++ libs/poolWorker.js | 39 ++++++++++++++++++++++++++++++++++++--- libs/shareProcessor.js | 19 +++++++++++++++++-- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/init.js b/init.js index fc8a81bb1..582db8c7b 100644 --- a/init.js +++ b/init.js @@ -82,6 +82,10 @@ if (cluster.isWorker){ case 'profitSwitch': new ProfitSwitch(logger); break; + case 'switchingPaymentProcessor': + var SwitchingPaymentProcessor = require('./libs/switchingPaymentProcessor.js'); + new SwitchingPaymentProcessor(logger); + break; } return; @@ -356,7 +360,21 @@ var processCoinSwitchCommand = function(params, options, reply){ }; +var startSwitchingPaymentProcessor = function(){ + if (!fs.exists('libs/switchingPaymentProcessor.js')) return; + var worker = cluster.fork({ + workerType: 'switchingPaymentProcessor', + pools: JSON.stringify(poolConfigs), + portalConfig: JSON.stringify(portalConfig) + }); + worker.on('exit', function(code, signal){ + logger.error('Master', 'Switching Payment Processor', 'Died, spawning replacement...'); + setTimeout(function(){ + startSwitchingPaymentProcessor(); + }, 2000); + }); +}; var startPaymentProcessor = function(){ @@ -434,6 +452,8 @@ var startProfitSwitch = function(){ startPaymentProcessor(); + startSwitchingPaymentProcessor(); + startWebsite(); startProfitSwitch(); diff --git a/libs/poolWorker.js b/libs/poolWorker.js index d85d01622..438a37934 100644 --- a/libs/poolWorker.js +++ b/libs/poolWorker.js @@ -4,6 +4,7 @@ var net = require('net'); var MposCompatibility = require('./mposCompatibility.js'); var ShareProcessor = require('./shareProcessor.js'); +var Stratum = require('stratum-pool'); module.exports = function(logger){ @@ -18,6 +19,33 @@ module.exports = function(logger){ var proxySwitch = {}; + var switchingDaemons = (function(){ + var daemons = {}; + + for (var switchName in portalConfig.switching){ + if (!portalConfig.switching[switchName].singleCoinPayout) continue; + var daemonConfig = portalConfig.switching[switchName].singleCoinPayout.daemon; + var daemon = new Stratum.daemon.interface([daemonConfig], function(severity, message){ + logger[severity](logSystem, logComponent, message); + }); + daemons[switchName] = daemon; + } + + return daemons; + })(); + + var singleCoinPayoutPorts = (function(){ + var ports = {}; + for (var switchName in portalConfig.switching){ + if (!portalConfig.switching[switchName].singleCoinPayout) continue; + for (var port in portalConfig.switching[switchName].ports){ + ports[parseInt(port)] = switchName; + } + } + return ports; + })(); + + var redisClient = redis.createClient(portalConfig.redis.port, portalConfig.redis.host); //Handle messages from master process sent via IPC @@ -128,10 +156,13 @@ module.exports = function(logger){ //Functions required for internal payment processing else{ - var shareProcessor = new ShareProcessor(logger, poolOptions); + var shareProcessor = new ShareProcessor(logger, portalConfig, poolOptions, singleCoinPayoutPorts); handlers.auth = function(port, workerName, password, authCallback){ - if (poolOptions.validateWorkerUsername !== true) + + var switchDaemon = switchingDaemons[singleCoinPayoutPorts[port]]; + + if (!switchDaemon && poolOptions.validateWorkerUsername !== true) authCallback(true); else { if (workerName.length === 40) { @@ -144,7 +175,9 @@ module.exports = function(logger){ } } else { - pool.daemon.cmd('validateaddress', [workerName], function (results) { + var daemon = switchDaemon || pool.daemon; + + daemon.cmd('validateaddress', [workerName], function (results) { var isValid = results.filter(function (r) { return r.response.isvalid }).length > 0; diff --git a/libs/shareProcessor.js b/libs/shareProcessor.js index 4495a00ca..90e1b0b9c 100644 --- a/libs/shareProcessor.js +++ b/libs/shareProcessor.js @@ -15,7 +15,7 @@ value: a hash with.. -module.exports = function(logger, poolConfig){ +module.exports = function(logger, portalConfig, poolConfig, singleCoinPayoutPorts){ var redisConfig = poolConfig.redis; var coin = poolConfig.coin.name; @@ -68,10 +68,25 @@ module.exports = function(logger, poolConfig){ this.handleShare = function(isValidShare, isValidBlock, shareData){ + + /*var shareKey = (function(){ + var port = shareData.port.toString(); + for (var switchName in portalConfig.switching){ + if (!portalConfig.switching[switchName]['singleCoinPayout']) continue; + var ports = Object.keys(portalConfig.switching[switchName].ports); + if (ports.indexOf(port) !== -1) return switchName; + } + return coin; + })();*/ + + var shareKey = singleCoinPayoutPorts[shareData.port] || coin; + + console.log('share key ' + shareKey); + var redisCommands = []; if (isValidShare){ - redisCommands.push(['hincrbyfloat', coin + ':shares:roundCurrent', shareData.worker, shareData.difficulty]); + redisCommands.push(['hincrbyfloat', shareKey + ':shares:roundCurrent', shareData.worker, shareData.difficulty]); redisCommands.push(['hincrby', coin + ':stats', 'validShares', 1]); } else{ From 8a725c04385adf3ae1151f736e950a7f4978ebe2 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Thu, 29 May 2014 15:59:19 -0600 Subject: [PATCH 02/16] Fix for file check --- init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.js b/init.js index 582db8c7b..8cc3c1384 100644 --- a/init.js +++ b/init.js @@ -361,7 +361,7 @@ var processCoinSwitchCommand = function(params, options, reply){ }; var startSwitchingPaymentProcessor = function(){ - if (!fs.exists('libs/switchingPaymentProcessor.js')) return; + if (!fs.existsSync('libs/switchingPaymentProcessor.js')) return; var worker = cluster.fork({ workerType: 'switchingPaymentProcessor', From 67254f63bab7776ace440d8e10306d519d9a68e5 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Sun, 13 May 2018 14:02:08 -0700 Subject: [PATCH 03/16] Update dev branch (#598) * modified for my repositry * Revert * add lf * Fixed bug in parsing balances for payment processing * Added fixminer.com pool * New pool Another one using NOMP * Update 21coin.json Added peerMagic needed for p2p block notifications * Update alphacoin.json Added peerMagic. Needed for p2p block notifications * Update benjamins.json Added peerMagic for p2p block notifications * Update mazacoin.json Added peerMagic for p2p block notifications * Update bottlecaps.json * Update bottlecaps.json * Create bunnycoin.json * Update bunnycoin.json * Update casinocoin.json * Create coino.json * Update coino.json * Create cryptogenicbullion.json * Update coino.json * Update bunnycoin.json * Update cryptogenicbullion.json * Create cryptographicanomaly.json * Update cryptographicanomaly.json * Update cryptographicanomaly.json * Fix switching port showing Fix reading of config file to show active switching ports * Update alphacoin.json * Update README.md fixed typo on line 529 node-statum-pool to node-stratum-pool * Update README.md * Valid json to Readme example coin conf * Minor readme change * Marked emark as POS type coin since auto detection fails * created infinitecoin.conf Adding infinitecoin.conf to the coin list. https://github.com/infinitecoin/infinitecoin/blob/master/src/main.cpp#L2524 * fixed capitolization Adjusted InfiniteCoin to Infinitecoin to match the naming practice of all the other coins. * update symbol for Coino * Wrong hashrate calculation Hashes are not bytes: > 1 byte = 8 bits > 1 kilobyte = 1024 bytes Hashes are the units, and so therefore - as `k`, `m` only mean *10^3 and *10^6 > 1 hash = 1 hash > 1 kh = 1000 hashes * Add Viacoin support Support for Viacoin - viacoin.org * Add FlutterCoin to coins * Rename viacoin.conf to viacoin.json * 42 coin * Update poolWorker.js var created above is spelled as initalPool not initialPool. * http://poollo.com "service unavailable" * Removed the links to dead pools * http://poollo.com * http://fixminer.com * http://pool.trademybit.com/ (all wallets disabled) * http://www.omargpools.ca/pools.html (dead link) * http://mining.theminingpools.com (now called "ad depo", no sign of a mining pool). * http://minr.es (dead link) * http://onebtcplace.com (link leads nowhere) * http://uberpools.org (Apache Test Page) * http://miningwith.us (domain for sale) * http://teamdoge.com (blank page) * http://rapidhash.net (domain for sale) * http://chunkypools.com Left these three. Are they still nomp? * http://miningpoolhub.com (Donations to this project are going directly to TheSerapher, the original author of this project. (https://github.com/MPOS/php-mpos) ### * http://hashfaster.com (MPOS, sign up) ### * http://suchpool.pw ### * Removed " LiveChains UK offers full hosting, setup and management of NOMP pools with several different configurations. [...] LiveChains UK however does offer this feature as part of there own customised NOMP called LivePool." Paid Solution." from 'Paid Solution'. The company no longer exists and the links lead to a generic type of forum about software. * Added some log info and fixed a typo * Pinned some package versions - included async package Should fix https://github.com/zone117x/node-open-mining-portal/pull/479 * Update litecoin testnet magic Litecoin testnet has been reset https://github.com/litecoin-project/litecoin/commit/2fcf8079ef0834fc9aaf51f99a7d23747f7ac800#diff-64cbe1ad5465e13bc59ee8bb6f3de2e7R207 * fix orphan stat source * API does not set the proper header * Update api.js Fix : #554 * Update package.json Pin request npm package version * Update README.md * Update README.md * Updated to new Core 0.16 Format (getaddressinfo) Since the new Wallet release of Bitcoin Core, they introduced a new Validation format for addresses. Validateaddress is not longer working. * Update paymentProcessor.js * Final change * Added GLT Coin * add peer magic for DGB (#592) --- README.md | 27 +++++++++++++++------------ coins/21coin.json | 4 +++- coins/42.json | 5 +++++ coins/alphacoin.json | 6 ++++-- coins/benjamins.json | 4 +++- coins/bottlecaps.json | 6 ++++-- coins/bunnycoin.json | 7 +++++++ coins/casinocoin.json | 6 ++++-- coins/coino.json | 7 +++++++ coins/cryptogenicbullion.json | 7 +++++++ coins/cryptographicanomaly.json | 7 +++++++ coins/digibyte.json | 4 +++- coins/emark.json | 3 ++- coins/fluttercoin.json | 5 +++++ coins/globaltoken.json | 7 +++++++ coins/infinitecoin.conf | 7 +++++++ coins/kumacoin.json | 6 ++++++ coins/litecoin.json | 4 ++-- coins/mazacoin.json | 4 +++- coins/monacoin.json | 5 +++++ coins/sayacoin.json | 5 +++++ coins/sha1coin.json | 5 +++++ coins/viacoin.json | 7 +++++++ libs/api.js | 4 +++- libs/paymentProcessor.js | 21 ++++++++++++++++----- libs/poolWorker.js | 12 ++++++++---- libs/shareProcessor.js | 2 +- libs/stats.js | 6 +++--- package.json | 10 +++++----- website/pages/getting_started.html | 14 +++++++------- 30 files changed, 166 insertions(+), 51 deletions(-) create mode 100644 coins/42.json create mode 100644 coins/bunnycoin.json create mode 100644 coins/coino.json create mode 100644 coins/cryptogenicbullion.json create mode 100644 coins/cryptographicanomaly.json create mode 100644 coins/fluttercoin.json create mode 100644 coins/globaltoken.json create mode 100644 coins/infinitecoin.conf create mode 100644 coins/kumacoin.json create mode 100644 coins/monacoin.json create mode 100644 coins/sayacoin.json create mode 100644 coins/sha1coin.json create mode 100644 coins/viacoin.json diff --git a/README.md b/README.md index 85d400c94..756a2694c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +## This repo is looking for maintainers! Please reach out if interested. + +-------- + + # NOMP ![NOMP Logo](http://zone117x.github.io/node-open-mining-portal/logo.svg "NOMP Logo") #### Node Open Mining Portal @@ -8,6 +13,12 @@ responsive user-friendly front-end website featuring mining instructions, in-dep #### Production Usage Notice This is beta software. All of the following are things that can change and break an existing NOMP setup: functionality of any feature, structure of configuration files and structure of redis data. If you use this software in production then *DO NOT* pull new code straight into production usage because it can and often will break your setup and require you to tweak things like config files or redis data. +#### Paid Solution +Usage of this software requires abilities with sysadmin, database admin, coin daemons, and sometimes a bit of programming. Running a production pool can literally be more work than a full-time job. + + +**Coin switching & auto-exchanging for payouts in BTC/LTC** to miners is a feature that very likely will not be included in this project. + #### Table of Contents * [Features](#features) @@ -104,21 +115,13 @@ didn't follow the instructions in this README. Please __read the usage instructi If your pool uses NOMP let us know and we will list your website here. ##### Some pools using NOMP or node-stratum-module: -* http://chunkypools.com * http://clevermining.com -* http://rapidhash.net * http://suchpool.pw * http://hashfaster.com * http://miningpoolhub.com -* http://teamdoge.com -* http://miningwith.us * http://kryptochaos.com -* http://uberpools.org -* http://onebtcplace.com -* http://minr.es -* http://mining.theminingpools.com -* http://www.omargpools.ca/pools.html -* http://pool.trademybit.com/ +* http://miningpools.tk +* http://umine.co.uk Usage ===== @@ -348,7 +351,7 @@ Here is an example of the required fields: source code as the pchMessageStart variable. For example, litecoin mainnet magic: http://git.io/Bi8YFw And for litecoin testnet magic: http://git.io/NXBYJA */ - "peerMagic": "fbc0b6db" //optional + "peerMagic": "fbc0b6db", //optional "peerMagicTestnet": "fcc1b7dc" //optional //"txMessages": false, //options - defaults to false @@ -524,7 +527,7 @@ output from NOMP. #### Upgrading NOMP When updating NOMP to the latest code its important to not only `git pull` the latest from this repo, but to also update -the `node-statum-pool` and `node-multi-hashing` modules, and any config files that may have been changed. +the `node-stratum-pool` and `node-multi-hashing` modules, and any config files that may have been changed. * Inside your NOMP directory (where the init.js script is) do `git pull` to get the latest NOMP code. * Remove the dependenices by deleting the `node_modules` directory with `rm -r node_modules`. * Run `npm update` to force updating/reinstalling of the dependencies. diff --git a/coins/21coin.json b/coins/21coin.json index 8aa9ea57f..5fa143c77 100644 --- a/coins/21coin.json +++ b/coins/21coin.json @@ -1,5 +1,7 @@ { "name": "21coin", "symbol": "21", - "algorithm": "sha256" + "algorithm": "sha256", │····································· + "peerMagic": "21212121", │····································· + "peerMagicTestnet": "01fefe05" } diff --git a/coins/42.json b/coins/42.json new file mode 100644 index 000000000..a3f8b47fa --- /dev/null +++ b/coins/42.json @@ -0,0 +1,5 @@ +{ + "name": "42", + "symbol": "42", + "algorithm": "scrypt" +} diff --git a/coins/alphacoin.json b/coins/alphacoin.json index 2d25d0eb7..c1b4246db 100644 --- a/coins/alphacoin.json +++ b/coins/alphacoin.json @@ -1,5 +1,7 @@ { "name": "Alphacoin", "symbol": "ALF", - "algorithm": "scrypt" -} \ No newline at end of file + "algorithm": "scrypt", + "peerMagic": "fbc0b6db", + "peerMagicTestnet": "fcc1b7dc" +} diff --git a/coins/benjamins.json b/coins/benjamins.json index e73a1b6b6..04ca3c0ba 100644 --- a/coins/benjamins.json +++ b/coins/benjamins.json @@ -1,5 +1,7 @@ { "name": "Benjamins", "symbol": "BEN", - "algorithm": "sha256" + "algorithm": "sha256", + "peerMagic": "de698778", │····································· + "peerMagicTestnet": "0b110907" } diff --git a/coins/bottlecaps.json b/coins/bottlecaps.json index 1dcccb905..8274e17cb 100644 --- a/coins/bottlecaps.json +++ b/coins/bottlecaps.json @@ -1,5 +1,7 @@ { "name": "Bottlecaps", "symbol": "CAP", - "algorithm": "scrypt" -} \ No newline at end of file + "algorithm": "scrypt", + "peerMagic": "e4e8e9e5", + "peerMagicTestnet": "cdf2c0ef" +} diff --git a/coins/bunnycoin.json b/coins/bunnycoin.json new file mode 100644 index 000000000..55d8fe771 --- /dev/null +++ b/coins/bunnycoin.json @@ -0,0 +1,7 @@ +{ + "name": "BunnyCoin", + "symbol": "BUN", + "algorithm": "scrypt", + "peerMagic": "c0c0c0c0", + "peerMagicTestnet": "fcc1b7dc" + } diff --git a/coins/casinocoin.json b/coins/casinocoin.json index d6b396fdd..fa38a544e 100644 --- a/coins/casinocoin.json +++ b/coins/casinocoin.json @@ -1,5 +1,7 @@ { "name": "Casinocoin", "symbol": "CSC", - "algorithm": "scrypt" -} \ No newline at end of file + "algorithm": "scrypt", + "peerMagic": "fac3b6da", + "peerMagicTestnet": "fcc1b7dc" +} diff --git a/coins/coino.json b/coins/coino.json new file mode 100644 index 000000000..8d30f75e6 --- /dev/null +++ b/coins/coino.json @@ -0,0 +1,7 @@ +{ + "name": "Coino", + "symbol": "COINO", + "algorithm": "scrypt", + "peerMagic": "f1d1a7d8", + "peerMagicTestnet": "fcc1b7dc" +} diff --git a/coins/cryptogenicbullion.json b/coins/cryptogenicbullion.json new file mode 100644 index 000000000..dac937c16 --- /dev/null +++ b/coins/cryptogenicbullion.json @@ -0,0 +1,7 @@ +{ + "name": "CryptogenicBullion", + "symbol": "CGB", + "algorithm": "scrypt", + "peerMagic": "e4e8e9e5", + "peerMagicTestnet": "cdf2c0ef" +} diff --git a/coins/cryptographicanomaly.json b/coins/cryptographicanomaly.json new file mode 100644 index 000000000..8c97ff1ed --- /dev/null +++ b/coins/cryptographicanomaly.json @@ -0,0 +1,7 @@ +{ + "name": "CryptographicAnomaly", + "symbol": "CGA", + "algorithm": "scrypt", + "peerMagic": "fbc0b6db", + "peerMagicTestnet": "fcc1b7dc" +} diff --git a/coins/digibyte.json b/coins/digibyte.json index ed65fed61..52ad88e0d 100644 --- a/coins/digibyte.json +++ b/coins/digibyte.json @@ -1,5 +1,7 @@ { "name": "Digibyte", "symbol": "DGB", - "algorithm": "scrypt" + "algorithm": "scrypt", + "peerMagic": "fac3b6da", + "peerMagicTestnet": "fdc8bddd" } \ No newline at end of file diff --git a/coins/emark.json b/coins/emark.json index d14cd3eff..076b33808 100644 --- a/coins/emark.json +++ b/coins/emark.json @@ -1,5 +1,6 @@ { "name": "eMark", "symbol": "DEM", - "algorithm": "sha256" + "algorithm": "sha256", + "reward": "POS" } diff --git a/coins/fluttercoin.json b/coins/fluttercoin.json new file mode 100644 index 000000000..81b5dfb0a --- /dev/null +++ b/coins/fluttercoin.json @@ -0,0 +1,5 @@ +{ + "name": "FlutterCoin", + "symbol": "FLT", + "algorithm": "scrypt" +} diff --git a/coins/globaltoken.json b/coins/globaltoken.json new file mode 100644 index 000000000..580b5cd7e --- /dev/null +++ b/coins/globaltoken.json @@ -0,0 +1,7 @@ +{ + "name": "GlobalToken", + "symbol": "GLT", + "algorithm": "sha256", + "peerMagic": "c708d32d", + "peerMagicTestnet": "3a6f375b" +} diff --git a/coins/infinitecoin.conf b/coins/infinitecoin.conf new file mode 100644 index 000000000..a81791b65 --- /dev/null +++ b/coins/infinitecoin.conf @@ -0,0 +1,7 @@ +{ + "name": "Infinitecoin", + "symbol": "IFC", + "algorithm": "scrypt", + "peerMagic": "fbc0b6db", + "peerMagicTestnet": "fcc1b7dc" +} diff --git a/coins/kumacoin.json b/coins/kumacoin.json new file mode 100644 index 000000000..ab7e895d4 --- /dev/null +++ b/coins/kumacoin.json @@ -0,0 +1,6 @@ +{ + "name": "Kumacoin", + "symbol": "KUMA", + "algorithm": "quark", + "mposDiffMultiplier": 256 +} diff --git a/coins/litecoin.json b/coins/litecoin.json index 588af554f..33d5d55a6 100644 --- a/coins/litecoin.json +++ b/coins/litecoin.json @@ -3,5 +3,5 @@ "symbol": "LTC", "algorithm": "scrypt", "peerMagic": "fbc0b6db", - "peerMagicTestnet": "fcc1b7dc" -} \ No newline at end of file + "peerMagicTestnet": "fdd2c8f1" +} diff --git a/coins/mazacoin.json b/coins/mazacoin.json index 451738c49..9bc4ed965 100644 --- a/coins/mazacoin.json +++ b/coins/mazacoin.json @@ -1,5 +1,7 @@ { "name": "Mazacoin", "symbol": "MZC", - "algorithm": "sha256" + "algorithm": "sha256", + "peerMagic": "f8b503df", │····································· + "peerMagicTestnet": "05fea901" } diff --git a/coins/monacoin.json b/coins/monacoin.json new file mode 100644 index 000000000..d8897d43c --- /dev/null +++ b/coins/monacoin.json @@ -0,0 +1,5 @@ +{ + "name": "Monacoin", + "symbol": "MONA", + "algorithm": "scrypt" +} \ No newline at end of file diff --git a/coins/sayacoin.json b/coins/sayacoin.json new file mode 100644 index 000000000..933c87904 --- /dev/null +++ b/coins/sayacoin.json @@ -0,0 +1,5 @@ +{ + "name": "Sayacoin", + "symbol": "SYC", + "algorithm": "sha256" +} \ No newline at end of file diff --git a/coins/sha1coin.json b/coins/sha1coin.json new file mode 100644 index 000000000..81e0fd474 --- /dev/null +++ b/coins/sha1coin.json @@ -0,0 +1,5 @@ +{ + "name": "Sha1coin", + "symbol": "SHA", + "algorithm": "sha1coin" +} diff --git a/coins/viacoin.json b/coins/viacoin.json new file mode 100644 index 000000000..30157c9d3 --- /dev/null +++ b/coins/viacoin.json @@ -0,0 +1,7 @@ +{ + "name": "Viacoin", + "symbol": "VIA", + "algorithm": "scrypt", + "peerMagic": "0f68c6cb", + "peerMagicTestnet": "a9c5ef92" +} diff --git a/libs/api.js b/libs/api.js index 3a433ab50..1fe280408 100644 --- a/libs/api.js +++ b/libs/api.js @@ -15,9 +15,11 @@ module.exports = function(logger, portalConfig, poolConfigs){ this.handleApiRequest = function(req, res, next){ switch(req.params.method){ case 'stats': + res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(portalStats.statsString); return; case 'pool_stats': + res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(portalStats.statPoolHistory)); return; case 'live_stats': @@ -51,4 +53,4 @@ module.exports = function(logger, portalConfig, poolConfigs){ } }; -}; \ No newline at end of file +}; diff --git a/libs/paymentProcessor.js b/libs/paymentProcessor.js index 30054a3d8..9e0fc8447 100644 --- a/libs/paymentProcessor.js +++ b/libs/paymentProcessor.js @@ -70,10 +70,21 @@ function SetupForPool(logger, poolOptions, setupFinished){ callback(true); } else if (!result.response || !result.response.ismine) { - logger.error(logSystem, logComponent, - 'Daemon does not own pool address - payment processing can not be done with this daemon, ' - + JSON.stringify(result.response)); - callback(true); + daemon.cmd('getaddressinfo', [poolOptions.address], function(result) { + if (result.error){ + logger.error(logSystem, logComponent, 'Error with payment processing daemon, getaddressinfo failed ... ' + JSON.stringify(result.error)); + callback(true); + } + else if (!result.response || !result.response.ismine) { + logger.error(logSystem, logComponent, + 'Daemon does not own pool address - payment processing can not be done with this daemon, ' + + JSON.stringify(result.response)); + callback(true); + } + else{ + callback() + } + }, true); } else{ callback() @@ -169,7 +180,7 @@ function SetupForPool(logger, poolOptions, setupFinished){ var workers = {}; for (var w in results[0]){ - workers[w] = {balance: coinsToSatoshies(parseInt(results[0][w]))}; + workers[w] = {balance: coinsToSatoshies(parseFloat(results[0][w]))}; } var rounds = results[1].map(function(r){ diff --git a/libs/poolWorker.js b/libs/poolWorker.js index 438a37934..f1bc04c2c 100644 --- a/libs/poolWorker.js +++ b/libs/poolWorker.js @@ -217,12 +217,16 @@ 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); + logger.debug(logSystem, logComponent, logSubCat, 'Block found: ' + data.blockHash + ' by ' + data.worker); - if (isValidShare) + if (isValidShare) { + if(data.shareDiff > 1000000000) + logger.debug(logSystem, logComponent, logSubCat, 'Share was found with diff higher than 1.000.000.000!'); + else if(data.shareDiff > 1000000) + logger.debug(logSystem, logComponent, logSubCat, 'Share was found with diff higher than 1.000.000!'); logger.debug(logSystem, logComponent, logSubCat, 'Share accepted at diff ' + data.difficulty + '/' + data.shareDiff + ' by ' + data.worker + ' [' + data.ip + ']' ); - else if (!isValidShare) + } else if (!isValidShare) logger.debug(logSystem, logComponent, logSubCat, 'Share rejected: ' + shareData); handlers.share(isValidShare, isValidBlock, data) @@ -306,7 +310,7 @@ module.exports = function(logger){ if (pools[currentPool]) pools[currentPool].getStratumServer().handleNewClient(socket); else - pools[initialPool].getStratumServer().handleNewClient(socket); + pools[initalPool].getStratumServer().handleNewClient(socket); }).listen(parseInt(port), function() { logger.debug(logSystem, logComponent, logSubCat, 'Switching "' + switchName diff --git a/libs/shareProcessor.js b/libs/shareProcessor.js index 90e1b0b9c..c1a7598b4 100644 --- a/libs/shareProcessor.js +++ b/libs/shareProcessor.js @@ -36,7 +36,7 @@ module.exports = function(logger, portalConfig, poolConfig, singleCoinPayoutPort logger.error(logSystem, logComponent, logSubCat, 'Redis client had an error: ' + JSON.stringify(err)) }); connection.on('end', function(){ - logger.error(logSystem, logComponent, logSubCat, 'Connection to redis database as been ended'); + logger.error(logSystem, logComponent, logSubCat, 'Connection to redis database has been ended'); }); connection.info(function(error, response){ diff --git a/libs/stats.js b/libs/stats.js index e12819001..1b22eb959 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -114,7 +114,7 @@ module.exports = function(logger, portalConfig, poolConfigs){ ['hgetall', ':stats'], ['scard', ':blocksPending'], ['scard', ':blocksConfirmed'], - ['scard', ':blocksOrphaned'] + ['scard', ':blocksKicked'] ]; var commandsPerCoin = redisCommandTemplates.length; @@ -274,9 +274,9 @@ module.exports = function(logger, portalConfig, poolConfigs){ var i = -1; var byteUnits = [ ' KH', ' MH', ' GH', ' TH', ' PH' ]; do { - hashrate = hashrate / 1024; + hashrate = hashrate / 1000; i++; - } while (hashrate > 1024); + } while (hashrate > 1000); return hashrate.toFixed(2) + byteUnits[i]; }; diff --git a/package.json b/package.json index f6467a2a8..b78c906bc 100644 --- a/package.json +++ b/package.json @@ -32,20 +32,20 @@ }, "dependencies": { "stratum-pool": "git://github.com/zone117x/node-stratum-pool.git", - "dateformat": "*", + "dateformat": "1.0.12", "node-json-minify": "*", - "redis": "*", + "redis": "0.12.1", "mysql": "*", - "async": "*", + "async": "1.5.2", "express": "*", "body-parser": "*", "compression": "*", "dot": "*", "colors": "*", "node-watch": "*", - "request": "*", + "request": "2.69.0", "nonce": "*", - "bignum": "*", + "bignum": "0.12.5", "extend": "*" }, "engines": { diff --git a/website/pages/getting_started.html b/website/pages/getting_started.html index c62495253..a563a68fc 100644 --- a/website/pages/getting_started.html +++ b/website/pages/getting_started.html @@ -185,9 +185,9 @@