Fixed extranonce location
This commit is contained in:
8
index.js
8
index.js
@@ -63,11 +63,12 @@ const diff1 = 0x00000000ff000000000000000000000000000000000000000000000000000000
|
|||||||
module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
|
module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
|
||||||
const poolAddrHash = bitcoin.address.fromBase58Check(poolAddress).hash;
|
const poolAddrHash = bitcoin.address.fromBase58Check(poolAddress).hash;
|
||||||
let txCoinbase = new bitcoin.Transaction();
|
let txCoinbase = new bitcoin.Transaction();
|
||||||
|
let bytesHeight;
|
||||||
{ // input for coinbase tx
|
{ // input for coinbase tx
|
||||||
let blockHeightSerial = rpcData.height.toString(16).length % 2 === 0 ?
|
let blockHeightSerial = rpcData.height.toString(16).length % 2 === 0 ?
|
||||||
rpcData.height.toString(16) :
|
rpcData.height.toString(16) :
|
||||||
'0' + rpcData.height.toString(16);
|
'0' + rpcData.height.toString(16);
|
||||||
const bytesHeight = Math.ceil((rpcData.height << 1).toString(2).length / 8);
|
bytesHeight = Math.ceil((rpcData.height << 1).toString(2).length / 8);
|
||||||
const lengthDiff = blockHeightSerial.length/2 - bytesHeight;
|
const lengthDiff = blockHeightSerial.length/2 - bytesHeight;
|
||||||
for (let i = 0; i < lengthDiff; i++) blockHeightSerial = blockHeightSerial + '00';
|
for (let i = 0; i < lengthDiff; i++) blockHeightSerial = blockHeightSerial + '00';
|
||||||
const serializedBlockHeight = new Buffer.concat([
|
const serializedBlockHeight = new Buffer.concat([
|
||||||
@@ -136,7 +137,8 @@ module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
|
|||||||
return {
|
return {
|
||||||
blocktemplate_blob: blob.toString('hex'),
|
blocktemplate_blob: blob.toString('hex'),
|
||||||
// reserved_offset to CCCCCC....
|
// reserved_offset to CCCCCC....
|
||||||
reserved_offset: offset1 + 4 /* txCoinbase.version */ + 1 /* vinLen */ + 32 /* hash */ + 4 /* index */ + 1 /* vScript len */,
|
reserved_offset: offset1 + 4 /* txCoinbase.version */ + 1 /* vinLen */ + 32 /* hash */ + 4 /* index */ +
|
||||||
|
1 /* vScript len */ + 1 /* coinbase height len */ + bytesHeight + 1 /* trailing zero byte */,
|
||||||
seed_hash: last_seed_hash.toString('hex'),
|
seed_hash: last_seed_hash.toString('hex'),
|
||||||
difficulty: difficulty,
|
difficulty: difficulty,
|
||||||
height: rpcData.height,
|
height: rpcData.height,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cryptoforknote-util",
|
"name": "cryptoforknote-util",
|
||||||
"version": "9.0.2",
|
"version": "9.0.3",
|
||||||
"main": "cryptoforknote-util",
|
"main": "cryptoforknote-util",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "LucasJones",
|
"name": "LucasJones",
|
||||||
|
|||||||
Reference in New Issue
Block a user