Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/blockTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, pool

function getTransactionBuffers(txs){
var txHashes = txs.map(function(tx){
if (tx.txid !== undefined) {
return util.uint256BufferFromHash(tx.txid);
}
return util.uint256BufferFromHash(tx.hash);
});
return [null].concat(txHashes);
Expand Down Expand Up @@ -136,4 +139,4 @@ var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, pool
}
return this.jobParams;
};
};
};
6 changes: 6 additions & 0 deletions lib/jobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ var JobManager = module.exports = function JobManager(options){
return util.reverseBuffer(hashDigest.apply(this, arguments));
};
}
case 'scrypt-og':
if (options.coin.reward === 'POS') {
return function (d) {
return util.reverseBuffer(hashDigest.apply(this, arguments));
};
}
case 'scrypt-jane':
if (options.coin.reward === 'POS') {
return function (d) {
Expand Down
4 changes: 2 additions & 2 deletions lib/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var pool = module.exports = function pool(options, authorizeFn){
function OnBlockchainSynced(syncedCallback){

var checkSynced = function(displayNotSynced){
_this.daemon.cmd('getblocktemplate', [], function(results){
_this.daemon.cmd('getblocktemplate', [{"capabilities": [ "coinbasetxn", "workid", "coinbase/append" ], "rules": [ "segwit" ]}], function(results){
var synced = results.every(function(r){
return !r.error || r.error.code !== -10;
});
Expand Down Expand Up @@ -566,7 +566,7 @@ var pool = module.exports = function pool(options, authorizeFn){

function GetBlockTemplate(callback){
_this.daemon.cmd('getblocktemplate',
[{"capabilities": [ "coinbasetxn", "workid", "coinbase/append" ]}],
[{"capabilities": [ "coinbasetxn", "workid", "coinbase/append" ], "rules": [ "segwit" ]}],
function(result){
if (result.error){
emitErrorLog('getblocktemplate call failed for daemon instance ' +
Expand Down
10 changes: 9 additions & 1 deletion lib/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ var generateOutputTransactions = function(poolRecipient, recipients, rpcData){
util.varIntBuffer(poolRecipient.length),
poolRecipient
]));


if (rpcData.default_witness_commitment !== undefined){
witness_commitment = new Buffer(rpcData.default_witness_commitment, 'hex');
txOutputBuffers.unshift(Buffer.concat([
util.packInt64LE(0),
util.varIntBuffer(witness_commitment.length),
witness_commitment
]));
}

return Buffer.concat([
util.varIntBuffer(txOutputBuffers.length),
Expand Down
6 changes: 3 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ Defined in bitcoin protocol here:
exports.varIntBuffer = function(n){
if (n < 0xfd)
return new Buffer([n]);
else if (n < 0xffff){
else if (n <= 0xffff){
var buff = new Buffer(3);
buff[0] = 0xfd;
buff.writeUInt16LE(n, 1);
return buff;
}
else if (n < 0xffffffff){
else if (n <= 0xffffffff){
var buff = new Buffer(5);
buff[0] = 0xfe;
buff.writeUInt32LE(n, 1);
Expand Down Expand Up @@ -373,4 +373,4 @@ exports.convertBitsToBuff = function(bitsBuff){

exports.getTruncatedDiff = function(shift){
return exports.convertBitsToBuff(exports.bufferToCompactBits(exports.shiftMax256Right(shift)));
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stratum-pool",
"version": "0.1.6",
"version": "0.1.9",
"description": "High performance Stratum poolserver in Node.js",
"keywords": [
"stratum",
Expand Down