@@ -55,7 +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
+ this . seedHash = template . seed_hash ? Buffer . from ( template . seed_hash , 'hex' ) : Buffer . from ( '00' , 'hex' ) ;
59
59
if ( typeof ( this . workerOffset ) === 'undefined' ) {
60
60
this . solo = true ;
61
61
global . instanceId . copy ( this . buffer , this . reservedOffset + 4 , 0 , 3 ) ;
@@ -92,7 +92,7 @@ function MasterBlockTemplate(template) {
92
92
this . workerNonce = 0 ;
93
93
this . poolNonce = 0 ;
94
94
this . solo = false ;
95
- this . seedHash = template . seed_hash ;
95
+ this . seedHash = template . seed_hash ? Buffer . from ( template . seed_hash , 'hex' ) : Buffer . from ( '00' , 'hex' ) ;
96
96
if ( typeof ( this . workerOffset ) === 'undefined' ) {
97
97
this . solo = true ;
98
98
global . instanceId . copy ( this . buffer , this . reservedOffset + 4 , 0 , 3 ) ;
@@ -197,10 +197,11 @@ function processShare(miner, job, blockTemplate, nonce, resultHash) {
197
197
// Validate share with CN hash, then if valid, blast it up to the master.
198
198
let shareBuffer = cnUtil . construct_block_blob ( template , new Buffer ( nonce , 'hex' ) ) ;
199
199
let convertedBlob = cnUtil . convert_blob ( shareBuffer ) ;
200
- if ( blockTemplate . seedHash == null || blockTemplate . seedHash === Buffer . from ( '00' , 'hex' ) ) {
200
+ let nulbuf = Buffer . from ( '00' , 'hex' ) ;
201
+ if ( blockTemplate . seedHash == null || blockTemplate . seedHash === nulbuf ) {
201
202
hash = multiHashing . cryptonight ( convertedBlob , convertedBlob [ 0 ] >= 10 ? 13 : 8 , job . height ) ;
202
203
} else {
203
- hash = multiHashing . randomx ( convertedBlob , Buffer . from ( blockTemplate . seedHash , 'hex' ) , 0 ) ;
204
+ hash = multiHashing . randomx ( convertedBlob , blockTemplate . seedHash , 0 ) ;
204
205
}
205
206
if ( hash . toString ( "hex" ) !== resultHash ) {
206
207
if ( multiHashing . cryptonight ( convertedBlob , 0 ) . toString ( "hex" ) === resultHash ) {
0 commit comments