|
@ -37,10 +37,8 @@ Transaction.prototype.addInput = function(tx, index, sequence) { |
|
|
var hash |
|
|
var hash |
|
|
|
|
|
|
|
|
if (typeof tx === 'string') { |
|
|
if (typeof tx === 'string') { |
|
|
hash = new Buffer(tx, 'hex') |
|
|
|
|
|
|
|
|
|
|
|
// TxId hex is big-endian, we need little-endian
|
|
|
// TxId hex is big-endian, we need little-endian
|
|
|
Array.prototype.reverse.call(hash) |
|
|
hash = bufferutils.reverse(new Buffer(tx, 'hex')) |
|
|
|
|
|
|
|
|
} else if (tx instanceof Transaction) { |
|
|
} else if (tx instanceof Transaction) { |
|
|
hash = tx.getHash() |
|
|
hash = tx.getHash() |
|
@ -211,12 +209,8 @@ Transaction.prototype.getHash = function () { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Transaction.prototype.getId = function () { |
|
|
Transaction.prototype.getId = function () { |
|
|
var buffer = this.getHash() |
|
|
// TxHash is little-endian, we need big-endian
|
|
|
|
|
|
return bufferutils.reverse(this.getHash()).toString('hex') |
|
|
// Big-endian is used for TxHash
|
|
|
|
|
|
Array.prototype.reverse.call(buffer) |
|
|
|
|
|
|
|
|
|
|
|
return buffer.toString('hex') |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Transaction.prototype.clone = function () { |
|
|
Transaction.prototype.clone = function () { |
|
|