some comments

This commit is contained in:
Matthew Little 2014-01-16 10:05:44 -07:00
parent e1c24559f0
commit 08e16cfb28
5 changed files with 14 additions and 11 deletions

View File

@ -9,7 +9,7 @@ var util = require('./util.js');
/** /**
* The BlockTemplate class holds a single job. * The BlockTemplate class holds a single job.
* and provides serveral methods to validate and submit it to the daemon coin * and provides several methods to validate and submit it to the daemon coin
**/ **/
var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, publicKey, extraNoncePlaceholder){ var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, publicKey, extraNoncePlaceholder){

View File

@ -46,8 +46,8 @@ var JobCounter = function(){
/** /**
* Emits: * Emits:
* - 'newBlock'(blockTemplate) - when a new block (previously unknown to the JobManager) is being added * - newBlock(blockTemplate) - When a new block (previously unknown to the JobManager) is added, use this event to broadcast new jobs
* - 'blockFound'(serializedBlock) - when a worker finds a block. * - share(shareData, blockHex) - When a worker submits a share. It will have blockHex if a block was found
**/ **/
var JobManager = module.exports = function JobManager(options){ var JobManager = module.exports = function JobManager(options){

View File

@ -22,8 +22,8 @@ var SubscriptionCounter = function(){
/** /**
* Defining each client that connects to the stratum server. * Defining each client that connects to the stratum server.
* Emits: * Emits:
* - 'subscription'(obj, cback(error, extraNonce1, extraNonce2Size)) * - subscription(obj, cback(error, extraNonce1, extraNonce2Size))
* - 'submit' FIX THIS. * - submit(data(name, jobID, extraNonce2, ntime, nonce))
**/ **/
var StratumClient = function(options){ var StratumClient = function(options){

View File

@ -120,9 +120,10 @@ var Generation = exports.Generation = function Generation(rpcData, publicKey, ex
/* /*
Creating this function required tons of trial and error and reversing existing This function creates the generation transaction that accepts the reward for
pool server code. I went to write a good comment describing how it works in detail but successfully mining a new block. Creating this function required tons of trial
at this point I don't even know.. and error and reversing existing pool server code. I went to write a good comment
describing how it works in detail but at this point I don't even know..
For some (probably outdated and incorrect) documentation about whats kinda going on here, For some (probably outdated and incorrect) documentation about whats kinda going on here,
see: https://en.bitcoin.it/wiki/Protocol_specification#tx see: https://en.bitcoin.it/wiki/Protocol_specification#tx

View File

@ -47,6 +47,10 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
var _this = this; var _this = this;
this.setNetworkDifficulty = function(diff){
networkDifficulty = diff;
};
if (!options.enabled){ if (!options.enabled){
return; return;
} }
@ -57,9 +61,7 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
var tMin = options.targetTime - variance; var tMin = options.targetTime - variance;
var tMax = options.targetTime + variance; var tMax = options.targetTime + variance;
this.setNetworkDifficulty = function(diff){
networkDifficulty = diff;
};
setInterval(function(){ setInterval(function(){
_this.emit('difficultyRequest'); _this.emit('difficultyRequest');