some comments
This commit is contained in:
parent
e1c24559f0
commit
08e16cfb28
@ -9,7 +9,7 @@ var util = require('./util.js');
|
||||
|
||||
/**
|
||||
* 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){
|
||||
|
||||
|
||||
@ -46,8 +46,8 @@ var JobCounter = function(){
|
||||
|
||||
/**
|
||||
* Emits:
|
||||
* - 'newBlock'(blockTemplate) - when a new block (previously unknown to the JobManager) is being added
|
||||
* - 'blockFound'(serializedBlock) - when a worker finds a block.
|
||||
* - newBlock(blockTemplate) - When a new block (previously unknown to the JobManager) is added, use this event to broadcast new jobs
|
||||
* - 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){
|
||||
|
||||
|
||||
@ -22,8 +22,8 @@ var SubscriptionCounter = function(){
|
||||
/**
|
||||
* Defining each client that connects to the stratum server.
|
||||
* Emits:
|
||||
* - 'subscription'(obj, cback(error, extraNonce1, extraNonce2Size))
|
||||
* - 'submit' FIX THIS.
|
||||
* - subscription(obj, cback(error, extraNonce1, extraNonce2Size))
|
||||
* - submit(data(name, jobID, extraNonce2, ntime, nonce))
|
||||
**/
|
||||
var StratumClient = function(options){
|
||||
|
||||
|
||||
@ -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
|
||||
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..
|
||||
This function creates the generation transaction that accepts the reward for
|
||||
successfully mining a new block. Creating this function required tons of trial
|
||||
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,
|
||||
see: https://en.bitcoin.it/wiki/Protocol_specification#tx
|
||||
|
||||
@ -47,6 +47,10 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
|
||||
|
||||
var _this = this;
|
||||
|
||||
this.setNetworkDifficulty = function(diff){
|
||||
networkDifficulty = diff;
|
||||
};
|
||||
|
||||
if (!options.enabled){
|
||||
return;
|
||||
}
|
||||
@ -57,9 +61,7 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
|
||||
var tMin = options.targetTime - variance;
|
||||
var tMax = options.targetTime + variance;
|
||||
|
||||
this.setNetworkDifficulty = function(diff){
|
||||
networkDifficulty = diff;
|
||||
};
|
||||
|
||||
|
||||
setInterval(function(){
|
||||
_this.emit('difficultyRequest');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user