You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionGetBlockTemplate(callback){functiongetBlockSubsidyandTemplate(){_this.daemon.cmd('getblocktemplate',[{"capabilities": ["coinbasetxn","workid","coinbase/append"]}],function(result){if(result.error){emitErrorLog('getblocktemplate call failed for daemon instance '+result.instance.index+' with error '+JSON.stringify(result.error));callback(result.error);}elseif(result[0].response==null){emitErrorLog('getblocktemplate call failed because daemon template code is still fucked up');getBlockSubsidyandTemplate()}elseif(result[0].response.coinbasetxn==null){emitErrorLog('getblocktemplate call failed for daemon with error 2 '+JSON.stringify(result));getBlockSubsidyandTemplate()}elseif(typeofresult[0].response==='undefined'){emitErrorLog('getblocktemplate call failed for daemon with error 3 '+JSON.stringify(result));getBlockSubsidyandTemplate()}elseif(typeofresult[0].response.coinbasetxn==='undefined'){emitErrorLog('getblocktemplate call failed for daemon with error 4 '+JSON.stringify(result));getBlockSubsidyandTemplate()}else{getRawTransaction(result[0].response)}})}//TODO(alstr): Fix diff template//Only use this slower method for coins that need itfunctiongetRawTransaction(template){template.miner=template.coinbasetxn.coinbasevalue;template.miner=(template.miner/Math.pow(10,8));template.miner=parseFloat(template.miner.toFixed(8));_this.daemon.cmd('decoderawtransaction',[template.coinbasetxn.data],function(result){if(result.error){emitErrorLog('decoderawtransaction call failed for daemon instance '+result.instance.index+' with error '+JSON.stringify(result.error));callback(result.error);}else{template.vouts=result.response.vout;//emitErrorLog('total vouts: ' + JSON.stringify(result.response.vout.length));//emitLog('miner ' + JSON.stringify(template.miner));//emitLog('founder ' + JSON.stringify(template.founders));varprocessedNewBlock=_this.jobManager.processTemplate(template);callback(null,template,processedNewBlock);callback=function(){};}},true);}functiongetNextBlockHeight(){_this.daemon.cmd('getblockcount',[],function(result){"response"inresult[0] ? console.log(result[0].response) : console.log(result)})}if(options.coin.symbol=="MCL"){getNextBlockHeight();}getBlockSubsidyandTemplate();}functionCheckBlockAccepted(blockHash,callback){_this.daemon.cmd('getblock',[blockHash],function(results){varvalidResults=results.filter(function(result){returnresult.response&&(result.response.hash===blockHash)});validResults.length>=1 ? callback(true,validResults[0].response.tx[0]) : callback(false)});}/** * This method is being called from the blockNotify so that when a new block is discovered by the daemon * We can inform our miners about the newly found block **///TODO(alstr): Fix height printthis.processBlockNotify=function(blockHash,sourceTrigger){if(!process.env.forkId||process.env.forkId==='0'){//console.log(_this.jobManager.meh);//var logheight = JSON.stringify(_this.jobManager.currentJob.rpcData.height);emitLog('Block notification via '+sourceTrigger+' -->> Block: '+_this.jobManager.currentJob.rpcData.height);}if(typeof(_this.jobManager)!=='undefined'&&typeof(_this.jobManager.currentJob)!=='undefined'&&typeof(_this.jobManager.currentJob.rpcData.previousblockhash)!=='undefined'&&blockHash!==_this.jobManager.currentJob.rpcData.previousblockhash){GetBlockTemplate(function(error,result){if(error){emitErrorLog('Block notify error getting block template for '+options.coin.name);}})}};
The text was updated successfully, but these errors were encountered:
Only use this slower method for coins that need it
emitLog('miner ' + JSON.stringify(template.miner));
emitLog('founder ' + JSON.stringify(template.founders));
emitLog('miner ' + JSON.stringify(template.miner));
emitLog('founder ' + JSON.stringify(template.founders));
KMD-solo-mining/lib/stratum/pool.js
Line 409 in be66b06
The text was updated successfully, but these errors were encountered: