Compare commits

...

2 Commits

Author SHA1 Message Date
MoneroOcean 18eedca1e9 constructNewRavenBlob fix 2020-12-07 02:14:52 +00:00
MoneroOcean a697f0fa32 Replaced deleted merkle-bitcoin repo 2020-12-01 17:14:59 +00:00
2 changed files with 12 additions and 7 deletions
+10 -5
View File
@@ -146,22 +146,27 @@ module.exports.RavenBlockTemplate = function(rpcData, poolAddress) {
};
};
module.exports.convertRavenBlob = function(blobBuffer) {
let header = blobBuffer.slice(0, 80); // header
function update_merkle_root_hash(blob_in, blob_out) {
let offset = 80 + 8 + 32;
const nTransactions = varuint.decode(blobBuffer, offset);
const nTransactions = varuint.decode(blob_in, offset);
offset += varuint.decode.bytes;
let transactions = [];
for (let i = 0; i < nTransactions; ++i) {
const tx = bitcoin.Transaction.fromBuffer(blobBuffer.slice(offset), true);
const tx = bitcoin.Transaction.fromBuffer(blob_in.slice(offset), true);
transactions.push(tx);
offset += tx.byteLength();
}
getMerkleRoot2(transactions).copy(header, 4 + 32);
getMerkleRoot2(transactions).copy(blob_out, 4 + 32);
};
module.exports.convertRavenBlob = function(blobBuffer) {
let header = blobBuffer.slice(0, 80);
update_merkle_root_hash(blobBuffer, header);
return reverseBuffer(crypto.createHash('sha256').update(header).digest());
};
module.exports.constructNewRavenBlob = function(blockTemplate, nonceBuff, mixhashBuff) {
update_merkle_root_hash(blockTemplate, blockTemplate);
nonceBuff.copy (blockTemplate, 80, 0, 8);
mixhashBuff.copy(blockTemplate, 88, 0, 32);
return blockTemplate;
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "cryptoforknote-util",
"version": "9.0.3",
"version": "9.0.5",
"main": "cryptoforknote-util",
"author": {
"name": "LucasJones",
@@ -18,7 +18,7 @@
"sha3": "*",
"varuint-bitcoin": "^1.0.4",
"bitcoinjs-lib": "git+https://github.com/bitcoinjs/bitcoinjs-lib.git#533d6c2e6d0aa4111f7948b1c12003cf6ef83137",
"merkle-bitcoin": "git+https://github.com/joshuayabut/merkle-bitcoin.git#ec00ae20ba60d444e150ead03c747695ddaa83a1"
"merkle-bitcoin": "git+https://github.com/CloudMining/merkle-bitcoin.git#ec00ae20ba60d444e150ead03c747695ddaa83a1"
},
"keywords": [
"cryptonight",