Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
533f0f346e | ||
|
|
f45984792e | ||
|
|
6768df06eb | ||
|
|
3f321bfe45 | ||
|
|
f663457e2a | ||
|
|
57982f88b1 | ||
|
|
96ee77913d | ||
|
|
9c4baf14ac | ||
|
|
1f35bb34c4 | ||
|
|
a5c3b3fa2c | ||
|
|
4f298c3ead |
@ -50,6 +50,8 @@ Features
|
||||
* ✓ __Quark__ (Quarkcoin [QRK])
|
||||
* ✓ __X11__ (Darkcoin [DRK], Hirocoin, Limecoin)
|
||||
* ✓ __X13__ (MaruCoin, BoostCoin)
|
||||
* ✓ __X16R__ (PexaCoin, RavenCoin)
|
||||
* ✓ __X16RV2__ (PexaCoin, RavenCoin)
|
||||
* ✓ __NIST5__ (Talkcoin)
|
||||
* ✓ __Keccak__ (Maxcoin [MAX], HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
|
||||
* ✓ __Skein__ (Skeincoin [SKC])
|
||||
|
||||
@ -73,6 +73,7 @@ var algos = module.exports = global.algos = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
sha1: {
|
||||
hash: function(){
|
||||
return function(){
|
||||
@ -108,6 +109,22 @@ var algos = module.exports = global.algos = {
|
||||
}
|
||||
}
|
||||
},
|
||||
x16r: {
|
||||
multiplier: Math.pow(2, 8),
|
||||
hash: function(){
|
||||
return function(){
|
||||
return multiHashing.x16r.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
x16rv2: {
|
||||
multiplier: Math.pow(2, 8),
|
||||
hash: function(){
|
||||
return function(){
|
||||
return multiHashing.x16rv2.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
nist5: {
|
||||
hash: function(){
|
||||
return function(){
|
||||
@ -145,6 +162,14 @@ var algos = module.exports = global.algos = {
|
||||
}
|
||||
}
|
||||
},
|
||||
neoscrypt: {
|
||||
multiplier: Math.pow(2, 5),
|
||||
hash: function(){
|
||||
return function(){
|
||||
return multiHashing.neoscrypt.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
skein: {
|
||||
hash: function(){
|
||||
return function(){
|
||||
|
||||
@ -37,7 +37,7 @@ function DaemonInterface(daemons, logger){
|
||||
}
|
||||
|
||||
function isOnline(callback){
|
||||
cmd('getnetworkinfo', [], function(results){
|
||||
cmd('getpeerinfo', [], function(results){
|
||||
var allOnline = results.every(function(result){
|
||||
return !results.error;
|
||||
});
|
||||
|
||||
@ -69,7 +69,6 @@ var JobManager = module.exports = function JobManager(options){
|
||||
var coinbaseHasher = (function(){
|
||||
switch(options.coin.algorithm){
|
||||
case 'keccak':
|
||||
case 'blake':
|
||||
case 'fugue':
|
||||
case 'groestl':
|
||||
if (options.coin.normalHashing === true)
|
||||
@ -90,12 +89,6 @@ var JobManager = module.exports = function JobManager(options){
|
||||
return util.reverseBuffer(hashDigest.apply(this, arguments));
|
||||
};
|
||||
}
|
||||
case 'scrypt-og':
|
||||
if (options.coin.reward === 'POS') {
|
||||
return function (d) {
|
||||
return util.reverseBuffer(hashDigest.apply(this, arguments));
|
||||
};
|
||||
}
|
||||
case 'scrypt-jane':
|
||||
if (options.coin.reward === 'POS') {
|
||||
return function (d) {
|
||||
@ -103,7 +96,6 @@ var JobManager = module.exports = function JobManager(options){
|
||||
};
|
||||
}
|
||||
case 'scrypt-n':
|
||||
case 'sha1':
|
||||
return function (d) {
|
||||
return util.reverseBuffer(util.sha256d(d));
|
||||
};
|
||||
@ -236,7 +228,12 @@ var JobManager = module.exports = function JobManager(options){
|
||||
//Check if share is a block candidate (matched network difficulty)
|
||||
if (job.target.ge(headerBigNum)){
|
||||
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
|
||||
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
|
||||
if (options.coin.algorithm === 'blake' || options.coin.algorithm === 'neoscrypt') {
|
||||
blockHash = util.reverseBuffer(util.sha256d(headerBuffer, nTime)).toString('hex');
|
||||
}
|
||||
else {
|
||||
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.emitInvalidBlockHashes)
|
||||
|
||||
@ -188,6 +188,9 @@ var Peer = module.exports = function (options) {
|
||||
_this.emit('connected');
|
||||
}
|
||||
break;
|
||||
case commands.version.toString():
|
||||
SendMessage(commands.verack, Buffer.alloc(0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
23
lib/pool.js
23
lib/pool.js
@ -146,7 +146,8 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
|
||||
var generateProgress = function(){
|
||||
|
||||
_this.daemon.cmd('getblockchaininfo', [], function(results) {
|
||||
var cmd = options.coin.hasGetInfo ? 'getinfo' : 'getblockchaininfo';
|
||||
_this.daemon.cmd(cmd, [], function(results) {
|
||||
var blockCount = results.sort(function (a, b) {
|
||||
return b.response.blocks - a.response.blocks;
|
||||
})[0].response.blocks;
|
||||
@ -369,12 +370,15 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
var batchRpcCalls = [
|
||||
['validateaddress', [options.address]],
|
||||
['getdifficulty', []],
|
||||
['getblockchaininfo', []],
|
||||
['getnetworkinfo', []],
|
||||
['getmininginfo', []],
|
||||
['submitblock', []]
|
||||
];
|
||||
|
||||
if (options.coin.hasGetInfo) {
|
||||
batchRpcCalls.push(['getinfo', []]);
|
||||
} else {
|
||||
batchRpcCalls.push(['getblockchaininfo', []], ['getnetworkinfo', []]);
|
||||
}
|
||||
_this.daemon.batchCmd(batchRpcCalls, function(error, results){
|
||||
if (error || !results){
|
||||
emitErrorLog('Could not start pool, error with init batch RPC call: ' + JSON.stringify(error));
|
||||
@ -423,13 +427,18 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
}
|
||||
})();
|
||||
|
||||
options.testnet = (rpcResults.getblockchaininfo.chain === 'test') ? true : false;
|
||||
options.testnet = options.coin.hasGetInfo ? rpcResults.getinfo.testnet : (rpcResults.getblockchaininfo.chain === 'test') ? true : false;
|
||||
|
||||
options.protocolVersion = rpcResults.getnetworkinfo.protocolversion;
|
||||
options.protocolVersion = options.coin.hasGetInfo ? rpcResults.getinfo.protocolversion : rpcResults.getnetworkinfo.protocolversion;
|
||||
|
||||
var difficulty = options.coin.hasGetInfo ? rpcResults.getinfo.difficulty : rpcResults.getblockchaininfo.difficulty;
|
||||
if (typeof(difficulty) == 'object') {
|
||||
difficulty = difficulty['proof-of-work'];
|
||||
}
|
||||
|
||||
options.initStats = {
|
||||
connections: rpcResults.getnetworkinfo.connections,
|
||||
difficulty: rpcResults.getblockchaininfo.difficulty * algos[options.coin.algorithm].multiplier,
|
||||
connections: (options.coin.hasGetInfo ? rpcResults.getinfo.connections : rpcResults.getnetworkinfo.connections),
|
||||
difficulty: difficulty * algos[options.coin.algorithm].multiplier,
|
||||
networkHashRate: rpcResults.getmininginfo.networkhashps
|
||||
};
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ exports.CreateGeneration = function(rpcData, publicKey, extraNoncePlaceholder, r
|
||||
|
||||
var scriptSigPart1 = Buffer.concat([
|
||||
util.serializeNumber(rpcData.height),
|
||||
new Buffer(rpcData.coinbaseaux.flags, 'hex'),
|
||||
new Buffer([]),
|
||||
util.serializeNumber(Date.now() / 1000 | 0),
|
||||
new Buffer([extraNoncePlaceholder.length])
|
||||
]);
|
||||
|
||||
@ -12,9 +12,9 @@
|
||||
"litecoin",
|
||||
"scrypt"
|
||||
],
|
||||
"homepage": "https://github.com/zone117x/node-stratum-pool",
|
||||
"homepage": "https://github.com/ranchimall/node-stratum-pool",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zone117x/node-stratum-pool/issues"
|
||||
"url": "https://github.com/ranchimall/node-stratum-pool/issues"
|
||||
},
|
||||
"license": "GPL-2.0",
|
||||
"author": "Matthew Little",
|
||||
@ -25,11 +25,11 @@
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zone117x/node-stratum-pool.git"
|
||||
"url": "https://github.com/ranchimall/node-stratum-pool.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"multi-hashing": "git://github.com/zone117x/node-multi-hashing.git",
|
||||
"bignum": "*",
|
||||
"bignum": "0.12.1",
|
||||
"base58-native": "*",
|
||||
"async": "*"
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user