Skip to content

Commit

Permalink
Update block function to provide more data
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Beal committed Jul 22, 2014
1 parent f915bfd commit 4972177
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion example.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ pool.on('share', function(isValidShare, isValidBlock, data){
coin: The symbol of the coin found. ex: 'LTC'
blockHash: The hash of the block found and confirmed (at least for now) is in the blockchain.
*/
pool.on('block', function(coin, blockHash) {
pool.on('block', function(coin, height, blockHash, txHash) {
console.log('Mined block on ' + coin + ' network!');
console.log('HEIGHT: ' + height);
console.log('HASH: ' + blockHash);
console.log('TX: ' + txHash);
});

/*
Expand Down
1 change: 1 addition & 0 deletions lib/jobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ var JobManager = module.exports = function JobManager(options){
blockDiff : blockDiffAdjusted,
blockDiffActual: job.difficulty,
coinbaseBuffer: coinbaseBuffer,
txHash: coinbaseHash.toString('hex'),
headerHash: headerHash,
blockBigNum: headerBigNum,
blockHash: blockHash,
Expand Down
7 changes: 4 additions & 3 deletions lib/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,11 @@ var pool = module.exports = function pool(options, authorizeFn){

var auxResult = function(hash, aux) {
if(!hash) return;
CheckBlockAccepted(hash, _this.auxes[aux].daemon, function(accepted) {
CheckBlockAccepted(hash, _this.auxes[aux].daemon, function(accepted, tx, height) {
if(!accepted) emitErrorLog('Block was not detect to have been accepted by' + aux.name + ' network: ' + hash);
// Push a message to alert that an auxillery block was found
_this.emit('block', options.auxes[aux].symbol, hash);
// First get transaction ID of our coinbase transaction
_this.emit('block', options.auxes[aux].symbol, height, hash, tx, shareData.blockReward, shareData.difficulty, shareData.worker);
UpdateAuxes();
// Cant do anything here yet
// Skip the get block template. Just a secondary test
Expand Down Expand Up @@ -712,7 +713,7 @@ var pool = module.exports = function pool(options, authorizeFn){
});

if (validResults.length >= 1){
callback(true, validResults[0].response.tx[0]);
callback(true, validResults[0].response.tx[0], validResults[0].response.height);
}
else{
callback(false);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "merged-pool",
"version": "0.1.7",
"version": "0.1.8",
"description": "High performance Stratum poolserver in Node.js for merged mining",
"keywords": [
"stratum",
"merged",
"merged",
"mining",
"pool",
"server",
Expand All @@ -20,7 +20,7 @@
"license": "GPL-2.0",
"author": "Daniel Beal",
"contributors": [
"zone117x",
"zone117x",
"vekexasia",
"TheSeven"
],
Expand Down

0 comments on commit 4972177

Please sign in to comment.