Skip to content

Commit 2326257

Browse files
author
Alexander Blair
committed
Pool-Update: RX/0
Adds the RX/0 code to the system to handle the change over
1 parent 76148a0 commit 2326257

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

lib/coins/xmr.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ function Coin(data){
148148
this.clientNonceLocation = this.reserveOffset + 12;
149149
// The clientPoolLocation is for multi-thread/multi-server pools to handle the nonce for each of their tiers.
150150
this.clientPoolLocation = this.reserveOffset + 8;
151+
if (template.seed_hash) {
152+
this.seedHash = Buffer.from(template.seed_hash, 'hex');
153+
} else {
154+
this.seedHash = Buffer.from('00', 'hex');
155+
}
151156
this.nextBlob = function () {
152157
// Write a 32 bit integer, big-endian style to the 0 byte of the reserve offset.
153158
this.buffer.writeUInt32BE(++this.extraNonce, this.reserveOffset);

lib/pool.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
492492
difficulty: this.difficulty,
493493
diffHex: this.diffHex,
494494
submissions: [],
495+
seed_hash: activeBlockTemplate.seedHash ? activeBlockTemplate.seedHash.toString('hex') : null,
495496
blockHash: activeBlockTemplate.idHash
496497
};
497498

@@ -501,6 +502,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
501502
job_id: newJob.id,
502503
target: target,
503504
id: this.id,
505+
seed_hash: activeBlockTemplate.seedHash ? activeBlockTemplate.seedHash.toString('hex') : null,
504506
height: newJob.height
505507
};
506508
} else {
@@ -519,6 +521,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
519521
diffHex: this.diffHex,
520522
clientPoolLocation: activeBlockTemplate.clientPoolLocation,
521523
clientNonceLocation: activeBlockTemplate.clientNonceLocation,
524+
seed_hash: activeBlockTemplate.seedHash ? activeBlockTemplate.seedHash.toString('hex') : null,
522525
submissions: []
523526
};
524527
this.validJobs.enq(newJob);
@@ -531,6 +534,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
531534
client_pool_offset: activeBlockTemplate.clientPoolLocation,
532535
target_diff: this.difficulty,
533536
target_diff_hex: this.diffHex,
537+
seed_hash: activeBlockTemplate.seedHash ? activeBlockTemplate.seedHash.toString('hex') : null,
534538
job_id: newJob.id,
535539
id: this.id
536540
};
@@ -622,8 +626,13 @@ function processShare(miner, job, blockTemplate, params, sendReply) {
622626
}
623627
else {
624628
convertedBlob = global.coinFuncs.convertBlob(shareBuffer);
625-
hash = multiHashing.cryptonight(convertedBlob, convertedBlob[0] >= 10 ? 13 : 8, job.height);
626-
shareType = false;
629+
if (blockTemplate.seedHash && blockTemplate.seedHash.length == 32) {
630+
hash = multiHashing.randomx(convertedBlob, blockTemplate.seedHash, 0);
631+
shareType = false;
632+
} else {
633+
hash = multiHashing.cryptonight(convertedBlob, convertedBlob[0] >= 10 ? 13 : 8, job.height);
634+
shareType = false;
635+
}
627636
}
628637
if (hash.toString('hex') !== resultHash) {
629638
if (job.height >= 1546000 && coinFuncs.isxmr) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"optionalDependencies": {
4545
"cryptonote-util": "git://github.com/Snipa22/node-cryptonote-util.git#xmr-Nan-2.0",
46-
"cryptonight-hashing": "git+https://github.com/MoneroOcean/node-cryptonight-hashing.git#v8.0.0",
46+
"cryptonight-hashing": "git+https://github.com/MoneroOcean/node-cryptonight-hashing.git#865a1f18e7dd5cf0513ae6becfdbeba3a10c9fb9",
4747
"multi-hashing": "git+https://github.com/Snipa22/node-multi-hashing-aesni.git#v0.1"
4848
}
4949
}

0 commit comments

Comments
 (0)