Added tx to share emit
This commit is contained in:
parent
773df98ec3
commit
585baf7b92
@ -188,8 +188,13 @@ Listen to pool events
|
|||||||
difficulty: 64, //stratum client difficulty
|
difficulty: 64, //stratum client difficulty
|
||||||
height: 443795, //block height
|
height: 443795, //block height
|
||||||
networkDifficulty: 3349 //network difficulty for this block
|
networkDifficulty: 3349 //network difficulty for this block
|
||||||
|
|
||||||
//solution is set if block was found
|
//solution is set if block was found
|
||||||
solution: '110c0447171ad819dd181216d5d80f41e9218e25d833a2789cb8ba289a52eee4',
|
solution: '110c0447171ad819dd181216d5d80f41e9218e25d833a2789cb8ba289a52eee4',
|
||||||
|
|
||||||
|
//tx is the coinbase transaction hash from the block
|
||||||
|
tx: '41bb22d6cc409f9c0bae2c39cecd2b3e3e1be213754f23d12c5d6d2003d59b1d,
|
||||||
|
|
||||||
error: 'low share difficulty' //set if share is rejected for some reason
|
error: 'low share difficulty' //set if share is rejected for some reason
|
||||||
*/
|
*/
|
||||||
pool.on('share', function(isValidShare, isValidBlock, data){
|
pool.on('share', function(isValidShare, isValidBlock, data){
|
||||||
|
|||||||
13
lib/pool.js
13
lib/pool.js
@ -163,8 +163,9 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
emitShare();
|
emitShare();
|
||||||
else{
|
else{
|
||||||
SubmitBlock(blockHex, function(){
|
SubmitBlock(blockHex, function(){
|
||||||
CheckBlockAccepted(shareData.solution, function(isAccepted){
|
CheckBlockAccepted(shareData.solution, function(isAccepted, tx){
|
||||||
isValidBlock = isAccepted;
|
isValidBlock = isAccepted;
|
||||||
|
shareData.tx = tx;
|
||||||
emitShare();
|
emitShare();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -421,9 +422,13 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
_this.daemon.cmd('getblock',
|
_this.daemon.cmd('getblock',
|
||||||
[blockHash],
|
[blockHash],
|
||||||
function(results){
|
function(results){
|
||||||
if (results.filter(function(result){return result.response &&
|
|
||||||
(result.response.hash === blockHash)}).length >= 1){
|
var validResults = results.filter(function(result){
|
||||||
callback(true);
|
return result.response && (result.response.hash === blockHash)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (validResults.length >= 1){
|
||||||
|
callback(true, validResults[0].response.tx[0]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
callback(false);
|
callback(false);
|
||||||
|
|||||||
@ -337,8 +337,10 @@ var StratumServer = exports.Server = function StratumServer(ports, connectionTim
|
|||||||
|
|
||||||
(function init(){
|
(function init(){
|
||||||
|
|
||||||
|
var serversStarted = 0;
|
||||||
|
|
||||||
Object.keys(ports).forEach(function(port){
|
Object.keys(ports).forEach(function(port){
|
||||||
net.createServer({allowHalfOpen: true}, function(socket){
|
net.createServer({allowHalfOpen: false}, function(socket){
|
||||||
|
|
||||||
if (banning.enabled && socket.remoteAddress in bannedIPs){
|
if (banning.enabled && socket.remoteAddress in bannedIPs){
|
||||||
var bannedTime = bannedIPs[socket.remoteAddress];
|
var bannedTime = bannedIPs[socket.remoteAddress];
|
||||||
@ -353,7 +355,9 @@ var StratumServer = exports.Server = function StratumServer(ports, connectionTim
|
|||||||
|
|
||||||
handleNewClient(socket);
|
handleNewClient(socket);
|
||||||
}).listen(parseInt(port), function(){
|
}).listen(parseInt(port), function(){
|
||||||
_this.emit('started');
|
serversStarted++;
|
||||||
|
if (serversStarted === Object.keys(ports).length)
|
||||||
|
_this.emit('started');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -380,7 +384,6 @@ var StratumServer = exports.Server = function StratumServer(ports, connectionTim
|
|||||||
So every time broadcast jobs, we set a timeout to rebroadcast in 30 seconds unless cleared. */
|
So every time broadcast jobs, we set a timeout to rebroadcast in 30 seconds unless cleared. */
|
||||||
clearTimeout(rebroadcastTimeout);
|
clearTimeout(rebroadcastTimeout);
|
||||||
rebroadcastTimeout = setTimeout(function(){
|
rebroadcastTimeout = setTimeout(function(){
|
||||||
console.log('resent jobs');
|
|
||||||
var resendParams = jobParams;
|
var resendParams = jobParams;
|
||||||
resendParams[8] = false;
|
resendParams[8] = false;
|
||||||
_this.broadcastMiningJobs(resendParams);
|
_this.broadcastMiningJobs(resendParams);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user