Compare commits

...

1 Commits

Author SHA1 Message Date
MoneroOcean 8729782845 Fixed raven block processing 2020-12-09 04:26:14 +00:00
2 changed files with 9 additions and 5 deletions
+8 -4
View File
@@ -42,10 +42,14 @@ function hash256(buffer) {
};
function getMerkleRoot(transactions) {
if (transactions.length === 0) return null;
if (transactions.length === 1) return transactions[0].getHash();
let hashes = [ reverseBuffer(transactions[0].getHash()).toString('hex') ];
transactions.split(1).forEach(function (value) {
// error
if (transactions.length === 0) return new Buffer('0000000000000000000000000000000000000000000000000000000000000000', 'hex');
// coinbase tx only
const txhash0 = transactions[0].getHash();
if (transactions.length === 1) return txhash0;
// have other txs
let hashes = [ reverseBuffer(txhash0).toString('hex') ];
transactions.slice(1).forEach(function (value) {
hashes.push(value.hash);
});
return reverseBuffer(new Buffer(Object.values(merklebitcoin(hashes))[2].root, 'hex'));
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cryptoforknote-util",
"version": "9.0.15",
"version": "9.0.16",
"main": "cryptoforknote-util",
"author": {
"name": "LucasJones",