Merge pull request #478 from bitcoinjs/norev
remove use of buffer-reverse
This commit is contained in:
commit
85a399d46b
6 changed files with 7 additions and 8 deletions
|
@ -70,7 +70,7 @@ Block.prototype.getHash = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
Block.prototype.getId = function () {
|
Block.prototype.getId = function () {
|
||||||
return Array.prototype.reverse.call(this.getHash()).toString('hex')
|
return [].reverse.call(this.getHash()).toString('hex')
|
||||||
}
|
}
|
||||||
|
|
||||||
Block.prototype.getUTCDate = function () {
|
Block.prototype.getUTCDate = function () {
|
||||||
|
|
|
@ -247,7 +247,7 @@ Transaction.prototype.getHash = function () {
|
||||||
|
|
||||||
Transaction.prototype.getId = function () {
|
Transaction.prototype.getId = function () {
|
||||||
// transaction hash's are displayed in reverse order
|
// transaction hash's are displayed in reverse order
|
||||||
return Array.prototype.reverse.call(this.getHash()).toString('hex')
|
return [].reverse.call(this.getHash()).toString('hex')
|
||||||
}
|
}
|
||||||
|
|
||||||
Transaction.prototype.toBuffer = function () {
|
Transaction.prototype.toBuffer = function () {
|
||||||
|
|
|
@ -172,8 +172,7 @@ TransactionBuilder.prototype.addInput = function (txHash, vout, sequence, prevOu
|
||||||
// is it a hex string?
|
// is it a hex string?
|
||||||
if (typeof txHash === 'string') {
|
if (typeof txHash === 'string') {
|
||||||
// transaction hashs's are displayed in reverse order, un-reverse it
|
// transaction hashs's are displayed in reverse order, un-reverse it
|
||||||
txHash = new Buffer(txHash, 'hex')
|
txHash = [].reverse.call(new Buffer(txHash, 'hex'))
|
||||||
Array.prototype.reverse.call(txHash)
|
|
||||||
|
|
||||||
// is it a Transaction object?
|
// is it a Transaction object?
|
||||||
} else if (txHash instanceof Transaction) {
|
} else if (txHash instanceof Transaction) {
|
||||||
|
|
|
@ -150,7 +150,7 @@ describe('Bitcoin-core', function () {
|
||||||
var input = inputs[i]
|
var input = inputs[i]
|
||||||
|
|
||||||
// reverse because test data is reversed
|
// reverse because test data is reversed
|
||||||
var prevOutHash = Array.prototype.reverse.call(new Buffer(input[0], 'hex'))
|
var prevOutHash = [].reverse.call(new Buffer(input[0], 'hex'))
|
||||||
var prevOutIndex = input[1]
|
var prevOutIndex = input[1]
|
||||||
|
|
||||||
assert.deepEqual(txIn.hash, prevOutHash)
|
assert.deepEqual(txIn.hash, prevOutHash)
|
||||||
|
@ -203,7 +203,7 @@ describe('Bitcoin-core', function () {
|
||||||
var hashType = f[3]
|
var hashType = f[3]
|
||||||
|
|
||||||
// reverse because test data is reversed
|
// reverse because test data is reversed
|
||||||
var expectedHash = Array.prototype.reverse.call(new Buffer(f[4], 'hex'))
|
var expectedHash = [].reverse.call(new Buffer(f[4], 'hex'))
|
||||||
|
|
||||||
var hashTypes = []
|
var hashTypes = []
|
||||||
if ((hashType & 0x1f) === bitcoin.Transaction.SIGHASH_NONE) hashTypes.push('SIGHASH_NONE')
|
if ((hashType & 0x1f) === bitcoin.Transaction.SIGHASH_NONE) hashTypes.push('SIGHASH_NONE')
|
||||||
|
|
|
@ -134,7 +134,7 @@ describe('bitcoinjs-lib (crypto)', function () {
|
||||||
|
|
||||||
assert(bitcoin.script.isPubKeyHashInput(scriptChunks), 'Expected pubKeyHash script')
|
assert(bitcoin.script.isPubKeyHashInput(scriptChunks), 'Expected pubKeyHash script')
|
||||||
|
|
||||||
var prevOutTxId = Array.prototype.reverse.call(new Buffer(transaction.ins[input.vout].hash)).toString('hex')
|
var prevOutTxId = [].reverse.call(new Buffer(transaction.ins[input.vout].hash)).toString('hex')
|
||||||
var prevVout = transaction.ins[input.vout].index
|
var prevVout = transaction.ins[input.vout].index
|
||||||
|
|
||||||
tasks.push(function (callback) {
|
tasks.push(function (callback) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ describe('TransactionBuilder', function () {
|
||||||
var tx = new Transaction()
|
var tx = new Transaction()
|
||||||
|
|
||||||
f.inputs.forEach(function (input) {
|
f.inputs.forEach(function (input) {
|
||||||
var txHash = Array.prototype.reverse.call(new Buffer(input.txId, 'hex'))
|
var txHash = [].reverse.call(new Buffer(input.txId, 'hex'))
|
||||||
|
|
||||||
tx.addInput(txHash, input.vout, undefined, bscript.fromASM(input.scriptSig))
|
tx.addInput(txHash, input.vout, undefined, bscript.fromASM(input.scriptSig))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue