GR support
This commit is contained in:
2
index.js
2
index.js
@@ -154,14 +154,12 @@ module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
|
|||||||
|
|
||||||
function update_merkle_root_hash(offset, payload, blob_in, blob_out) {
|
function update_merkle_root_hash(offset, payload, blob_in, blob_out) {
|
||||||
const nTransactions = varuint.decode(blob_in, offset);
|
const nTransactions = varuint.decode(blob_in, offset);
|
||||||
console.log("2x" + nTransactions);
|
|
||||||
offset += varuint.decode.bytes;
|
offset += varuint.decode.bytes;
|
||||||
let transactions = [];
|
let transactions = [];
|
||||||
for (let i = 0; i < nTransactions; ++i) {
|
for (let i = 0; i < nTransactions; ++i) {
|
||||||
const tx = bitcoin.Transaction.fromBuffer(blob_in.slice(offset), true, payload && i == 0);
|
const tx = bitcoin.Transaction.fromBuffer(blob_in.slice(offset), true, payload && i == 0);
|
||||||
transactions.push(tx);
|
transactions.push(tx);
|
||||||
offset += tx.byteLength();
|
offset += tx.byteLength();
|
||||||
console.log("2xx " + tx.byteLength());
|
|
||||||
}
|
}
|
||||||
getMerkleRoot(transactions).copy(blob_out, 4 + 32);
|
getMerkleRoot(transactions).copy(blob_out, 4 + 32);
|
||||||
};
|
};
|
||||||
|
|||||||
2
rtm.js
2
rtm.js
@@ -253,8 +253,6 @@ module.exports.RtmBlockTemplate = function(rpcData, poolAddress) {
|
|||||||
let bits = Buffer.from(rpcData.bits, 'hex');
|
let bits = Buffer.from(rpcData.bits, 'hex');
|
||||||
bits.writeUInt32LE(bits.readUInt32BE());
|
bits.writeUInt32LE(bits.readUInt32BE());
|
||||||
|
|
||||||
console.log("1x" + (rpcData.transactions.length + 1) + " " + (blob1.length + extraNoncePlaceholderLength + blob2.length));
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
difficulty: parseFloat((diff1 / bignum(rpcData.target, 16).toNumber()).toFixed(9)),
|
difficulty: parseFloat((diff1 / bignum(rpcData.target, 16).toNumber()).toFixed(9)),
|
||||||
height: rpcData.height,
|
height: rpcData.height,
|
||||||
|
|||||||
Reference in New Issue
Block a user