Reversed txhash

This commit is contained in:
vub 2013-10-08 13:41:20 -04:00
parent 7684c3f705
commit b8023389fd
2 changed files with 4 additions and 2 deletions

2
bitcoinjs-min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -217,11 +217,13 @@ function (connectedScript, inIndex, hashType)
/** /**
* Calculate and return the transaction's hash. * Calculate and return the transaction's hash.
* Reverses hash since blockchain.info, blockexplorer.com and others
* use little-endian hashes for some stupid reason
*/ */
Transaction.prototype.getHash = function () Transaction.prototype.getHash = function ()
{ {
var buffer = this.serialize(); var buffer = this.serialize();
return Crypto.SHA256(Crypto.SHA256(buffer, {asBytes: true}), {asBytes: true}); return Crypto.SHA256(Crypto.SHA256(buffer, {asBytes: true}), {asBytes: true}).reverse();
}; };
/** /**