@@ -55,6 +55,7 @@ function BlockTemplate(template) {
55
55
this . previousHash = new Buffer ( 32 ) ;
56
56
this . workerNonce = 0 ;
57
57
this . solo = false ;
58
+ this . seedHash = template . seed_hash ;
58
59
if ( typeof ( this . workerOffset ) === 'undefined' ) {
59
60
this . solo = true ;
60
61
global . instanceId . copy ( this . buffer , this . reservedOffset + 4 , 0 , 3 ) ;
@@ -91,6 +92,7 @@ function MasterBlockTemplate(template) {
91
92
this . workerNonce = 0 ;
92
93
this . poolNonce = 0 ;
93
94
this . solo = false ;
95
+ this . seedHash = template . seed_hash ;
94
96
if ( typeof ( this . workerOffset ) === 'undefined' ) {
95
97
this . solo = true ;
96
98
global . instanceId . copy ( this . buffer , this . reservedOffset + 4 , 0 , 3 ) ;
@@ -191,7 +193,11 @@ function processShare(miner, job, blockTemplate, nonce, resultHash) {
191
193
// Validate share with CN hash, then if valid, blast it up to the master.
192
194
let shareBuffer = cnUtil . construct_block_blob ( template , new Buffer ( nonce , 'hex' ) ) ;
193
195
let convertedBlob = cnUtil . convert_blob ( shareBuffer ) ;
194
- hash = multiHashing . cryptonight ( convertedBlob , convertedBlob [ 0 ] >= 10 ? 13 : 8 , job . height ) ;
196
+ if ( blockTemplate . seedHash == null || blockTemplate . seedHash !== Buffer . from ( '00' , 'hex' ) ) {
197
+ hash = multiHashing . cryptonight ( convertedBlob , convertedBlob [ 0 ] >= 10 ? 13 : 8 , job . height ) ;
198
+ } else {
199
+ hash = multiHashing . randomx ( convertedBlob , blockTemplate . seedHash , 0 ) ;
200
+ }
195
201
if ( hash . toString ( "hex" ) !== resultHash ) {
196
202
if ( multiHashing . cryptonight ( convertedBlob , 0 ) . toString ( "hex" ) === resultHash ) {
197
203
console . error ( `${ global . threadName } Invalid version of CN hashing algo (CN/0) used by miner ${ miner . logString } ` ) ;
0 commit comments