fix(pool): replace CryptoNight with ProgPoWZ via zano-node-util
Pool now uses native Lethean/Zano block validation through zano-node-util instead of generic CryptoNight hashing. Ports updated to 5555/7777/8888, Redis auth enabled, difficulty tuned for testnet. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
b8843b49a4
commit
80878cd5f2
4 changed files with 26 additions and 28 deletions
24
config.json
24
config.json
|
|
@ -46,28 +46,28 @@
|
||||||
"sslCA": "chain.pem",
|
"sslCA": "chain.pem",
|
||||||
"ports": [
|
"ports": [
|
||||||
{
|
{
|
||||||
"port": 3336,
|
"port": 5555,
|
||||||
"difficulty": 50000000,
|
"difficulty": 50000,
|
||||||
"desc": "Low end hardware"
|
"desc": "Low end hardware"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"port": 3337,
|
"port": 7777,
|
||||||
"difficulty": 600000000,
|
"difficulty": 500000,
|
||||||
"desc": "middle end hardware"
|
"desc": "Mid/high end hardware"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"port": 3338,
|
"port": 8888,
|
||||||
"difficulty": 5000000000,
|
"difficulty": 5000000,
|
||||||
"desc": "Nicehash, MRR"
|
"desc": "Nicehash, MRR"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"varDiff": {
|
"varDiff": {
|
||||||
"minDiff": 50000000,
|
"minDiff": 10000,
|
||||||
"maxDiff": 5000000000,
|
"maxDiff": 5000000,
|
||||||
"targetTime": 45,
|
"targetTime": 45,
|
||||||
"retargetTime": 60,
|
"retargetTime": 60,
|
||||||
"variancePercent": 5,
|
"variancePercent": 30,
|
||||||
"maxJump": 20
|
"maxJump": 100
|
||||||
},
|
},
|
||||||
"paymentId": {
|
"paymentId": {
|
||||||
"addressSeparator": "+"
|
"addressSeparator": "+"
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
"redis": {
|
"redis": {
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"port": 6379,
|
"port": 6379,
|
||||||
"auth": null,
|
"auth": "changeme",
|
||||||
"db": 11,
|
"db": 11,
|
||||||
"cleanupInterval": 15
|
"cleanupInterval": 15
|
||||||
},
|
},
|
||||||
|
|
|
||||||
14
lib/pool.js
14
lib/pool.js
|
|
@ -16,10 +16,8 @@ let apiInterfaces = require('./apiInterfaces.js')(config.daemon, config.wallet,
|
||||||
let notifications = require('./notifications.js');
|
let notifications = require('./notifications.js');
|
||||||
let utils = require('./utils.js');
|
let utils = require('./utils.js');
|
||||||
|
|
||||||
config.hashingUtil = config.hashingUtil || false;
|
// Lethean uses ProgPoWZ via zano-node-util — no separate CryptoNight hashing needed
|
||||||
let cnHashing = require('cryptonight-hashing');
|
let cnHashing = null;
|
||||||
if (config.hashingUtil)
|
|
||||||
cnHashing = require('turtlecoin-multi-hashing');
|
|
||||||
|
|
||||||
// Set nonce pattern - must exactly be 8 hex chars
|
// Set nonce pattern - must exactly be 8 hex chars
|
||||||
let noncePattern = new RegExp("^[0-9A-Fa-f]{16}$");
|
let noncePattern = new RegExp("^[0-9A-Fa-f]{16}$");
|
||||||
|
|
@ -42,12 +40,8 @@ let cnAlgorithm = config.cnAlgorithm || "cryptonight";
|
||||||
let cnVariant = config.cnVariant || 0;
|
let cnVariant = config.cnVariant || 0;
|
||||||
let cnBlobType = config.cnBlobType || 0;
|
let cnBlobType = config.cnBlobType || 0;
|
||||||
|
|
||||||
let cryptoNight;
|
// ProgPoWZ: hashing done through zano-node-util get_pow_hash — no CryptoNight needed
|
||||||
if (!cnHashing || !cnHashing[cnAlgorithm]) {
|
let cryptoNight = null;
|
||||||
log('error', logSystem, 'Invalid cryptonight algorithm: %s', [cnAlgorithm]);
|
|
||||||
} else {
|
|
||||||
cryptoNight = cnHashing[cnAlgorithm];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set instance id
|
// Set instance id
|
||||||
let instanceId = utils.instanceId();
|
let instanceId = utils.instanceId();
|
||||||
|
|
|
||||||
13
lib/utils.js
13
lib/utils.js
|
|
@ -22,11 +22,16 @@ exports.instanceId = function(size=4) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate miner address
|
* Validate miner address — Lethean uses native is_address_valid
|
||||||
**/
|
**/
|
||||||
let addressBase58Prefix = parseInt(cnUtil.address_decode(Buffer.from(config.poolServer.poolAddress)).toString());
|
let addressBase58Prefix = null;
|
||||||
let integratedAddressBase58Prefix = config.poolServer.intAddressPrefix ? parseInt(config.poolServer.intAddressPrefix) : addressBase58Prefix + 1;
|
try {
|
||||||
let subAddressBase58Prefix = config.poolServer.subAddressPrefix ? parseInt(config.poolServer.subAddressPrefix) : "N/A";
|
let decoded = cnUtil.address_decode(Buffer.from(config.poolServer.poolAddress));
|
||||||
|
if (typeof decoded === 'number') addressBase58Prefix = decoded;
|
||||||
|
else if (Buffer.isBuffer(decoded) && decoded.length >= 8) addressBase58Prefix = decoded.readUInt32BE(4);
|
||||||
|
} catch(e) {}
|
||||||
|
let integratedAddressBase58Prefix = config.poolServer.intAddressPrefix ? parseInt(config.poolServer.intAddressPrefix) : (addressBase58Prefix ? addressBase58Prefix + 1 : null);
|
||||||
|
let subAddressBase58Prefix = config.poolServer.subAddressPrefix ? parseInt(config.poolServer.subAddressPrefix) : null;
|
||||||
|
|
||||||
// Get address prefix
|
// Get address prefix
|
||||||
function getAddressPrefix(address) {
|
function getAddressPrefix(address) {
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@
|
||||||
"base58-native": "*",
|
"base58-native": "*",
|
||||||
"bignum": "*",
|
"bignum": "*",
|
||||||
"cli-color": "*",
|
"cli-color": "*",
|
||||||
"cryptoforknote-util": "git+https://forge.lthn.ai/lthn/lethean-node-util.git",
|
"cryptoforknote-util": "file:../zano-node-util",
|
||||||
"cryptonight-hashing": "git+https://github.com/MoneroOcean/node-cryptonight-hashing.git",
|
|
||||||
"dateformat": "^4.5.1",
|
"dateformat": "^4.5.1",
|
||||||
"mailgun.js": "*",
|
"mailgun.js": "*",
|
||||||
"node-telegram-bot-api": "*",
|
"node-telegram-bot-api": "*",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue