Bugfix: Merkleroot not calculated correctly for multi-transaction blocks
This commit is contained in:
parent
0789bfe61f
commit
cb984a997d
|
@ -9,13 +9,12 @@ function calcRoot(hashes) {
|
|||
}
|
||||
|
||||
exports.getRoot = function (rpcData, generateTxRaw) {
|
||||
hashes = [generateTxRaw];
|
||||
hashes = [util.reverseBuffer(Buffer(generateTxRaw, 'hex')).toString('hex')];
|
||||
rpcData.transactions.forEach(function (value) {
|
||||
hashes.push(value.hash);
|
||||
});
|
||||
if (hashes.length === 1) {
|
||||
result = util.reverseBuffer(Buffer(hashes[0], 'hex')).toString('hex');
|
||||
return result;
|
||||
return hashes[0];
|
||||
}
|
||||
var result = calcRoot(hashes);
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue