MCPcopy Create free account
hub / github.com/Snipa22/nodejs-pool / newBlockTemplate

Function newBlockTemplate

lib/pool.js:182–198  ·  view source on GitHub ↗
(template)

Source from the content-addressed store, hash-verified

180}
181
182function newBlockTemplate(template) {
183 let buffer = new Buffer(template.blocktemplate_blob, 'hex');
184 let previous_hash = new Buffer(32);
185 buffer.copy(previous_hash, 0, 7, 39);
186 console.log(threadName + 'New block to mine at height: ' + template.height + '. Difficulty: ' + template.difficulty);
187 if (activeBlockTemplate) {
188 pastBlockTemplates.enq(activeBlockTemplate);
189 }
190 activeBlockTemplate = new BlockTemplate(template);
191 for (let minerId in activeMiners) {
192 if (activeMiners.hasOwnProperty(minerId)) {
193 let miner = activeMiners[minerId];
194 debug(threadName + "Updating worker " + miner.payout + " With new work at height: " + template.height);
195 miner.sendNewJob();
196 }
197 }
198}
199
200let VarDiff = (function () {
201 let variance = global.config.pool.varDiffVariance / 100 * global.config.pool.targetTime;

Callers 2

messageHandlerFunction · 0.85
templateUpdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected