package: bump bs58check, drop node 0.12

This commit is contained in:
Daniel Cousens 2016-12-21 12:52:09 +11:00 committed by Daniel Cousens
parent 4aadbf5e4f
commit 14f9218389
8 changed files with 14 additions and 18 deletions

View file

@ -1,15 +1,15 @@
sudo: false sudo: false
language: node_js language: node_js
node_js: node_js:
- "0.12"
- "4" - "4"
- "5" - "5"
- "6" - "6"
- "7"
matrix: matrix:
include: include:
- node_js: "6" - node_js: "7"
env: TEST_SUITE=standard env: TEST_SUITE=standard
- node_js: "6" - node_js: "7"
env: TEST_SUITE=coverage env: TEST_SUITE=coverage
env: env:
- TEST_SUITE=integration - TEST_SUITE=integration

View file

@ -54,8 +54,7 @@
"bigi": "^1.4.0", "bigi": "^1.4.0",
"bip66": "^1.1.0", "bip66": "^1.1.0",
"bitcoin-ops": "^1.3.0", "bitcoin-ops": "^1.3.0",
"bs58check": "^1.0.5", "bs58check": "^2.0.0",
"buffer-reverse": "^1.0.0",
"create-hash": "^1.1.0", "create-hash": "^1.1.0",
"create-hmac": "^1.1.3", "create-hmac": "^1.1.3",
"ecurve": "^1.0.0", "ecurve": "^1.0.0",
@ -68,7 +67,7 @@
}, },
"devDependencies": { "devDependencies": {
"async": "^2.0.1", "async": "^2.0.1",
"bs58": "^3.0.0", "bs58": "^4.0.0",
"cb-http-client": "^0.2.0", "cb-http-client": "^0.2.0",
"coinselect": "^3.1.1", "coinselect": "^3.1.1",
"minimaldata": "^1.0.2", "minimaldata": "^1.0.2",

View file

@ -1,6 +1,5 @@
var bufferutils = require('./bufferutils') var bufferutils = require('./bufferutils')
var bcrypto = require('./crypto') var bcrypto = require('./crypto')
var bufferReverse = require('buffer-reverse')
var fastMerkleRoot = require('merkle-lib/fastRoot') var fastMerkleRoot = require('merkle-lib/fastRoot')
var typeforce = require('typeforce') var typeforce = require('typeforce')
var types = require('./types') var types = require('./types')
@ -80,7 +79,7 @@ Block.prototype.getHash = function () {
} }
Block.prototype.getId = function () { Block.prototype.getId = function () {
return bufferReverse(this.getHash()).toString('hex') return this.getHash().reverse().toString('hex')
} }
Block.prototype.getUTCDate = function () { Block.prototype.getUTCDate = function () {
@ -164,7 +163,7 @@ Block.prototype.checkMerkleRoot = function () {
} }
Block.prototype.checkProofOfWork = function () { Block.prototype.checkProofOfWork = function () {
var hash = bufferReverse(this.getHash()) var hash = this.getHash().reverse()
var target = Block.calculateTarget(this.bits) var target = Block.calculateTarget(this.bits)
return hash.compare(target) <= 0 return hash.compare(target) <= 0

View file

@ -1,7 +1,6 @@
var bcrypto = require('./crypto') var bcrypto = require('./crypto')
var bscript = require('./script') var bscript = require('./script')
var bufferutils = require('./bufferutils') var bufferutils = require('./bufferutils')
var bufferReverse = require('buffer-reverse')
var opcodes = require('bitcoin-ops') var opcodes = require('bitcoin-ops')
var typeforce = require('typeforce') var typeforce = require('typeforce')
var types = require('./types') var types = require('./types')
@ -395,7 +394,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 bufferReverse(this.getHash()).toString('hex') return this.getHash().reverse().toString('hex')
} }
Transaction.prototype.toBuffer = function (buffer, initialOffset) { Transaction.prototype.toBuffer = function (buffer, initialOffset) {

View file

@ -1,7 +1,6 @@
var baddress = require('./address') var baddress = require('./address')
var bcrypto = require('./crypto') var bcrypto = require('./crypto')
var bscript = require('./script') var bscript = require('./script')
var bufferReverse = require('buffer-reverse')
var networks = require('./networks') var networks = require('./networks')
var ops = require('bitcoin-ops') var ops = require('bitcoin-ops')
var typeforce = require('typeforce') var typeforce = require('typeforce')
@ -299,7 +298,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 = bufferReverse(new Buffer(txHash, 'hex')) txHash = new Buffer(txHash, 'hex').reverse()
// is it a Transaction object? // is it a Transaction object?
} else if (txHash instanceof Transaction) { } else if (txHash instanceof Transaction) {

View file

@ -22,7 +22,7 @@ describe('Bitcoin-core', function () {
it('can decode ' + fb58, function () { it('can decode ' + fb58, function () {
var buffer = base58.decode(fb58) var buffer = base58.decode(fb58)
var actual = new Buffer(buffer).toString('hex') var actual = buffer.toString('hex')
assert.strictEqual(actual, fhex) assert.strictEqual(actual, fhex)
}) })
@ -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 = [].reverse.call(new Buffer(input[0], 'hex')) var prevOutHash = new Buffer(input[0], 'hex').reverse()
var prevOutIndex = input[1] var prevOutIndex = input[1]
assert.deepEqual(txIn.hash, prevOutHash) assert.deepEqual(txIn.hash, prevOutHash)
@ -193,7 +193,7 @@ describe('Bitcoin-core', function () {
var hash = transaction.hashForSignature(inIndex, script, hashType) var hash = transaction.hashForSignature(inIndex, script, hashType)
// reverse because test data is reversed // reverse because test data is reversed
assert.equal([].reverse.call(hash).toString('hex'), expectedHash) assert.equal(hash.reverse().toString('hex'), expectedHash)
}) })
}) })
}) })

View file

@ -45,7 +45,7 @@ describe('bitcoinjs-lib (crypto)', function () {
assert(bitcoin.script.pubKeyHash.input.check(scriptChunks), 'Expected pubKeyHash script') assert(bitcoin.script.pubKeyHash.input.check(scriptChunks), 'Expected pubKeyHash script')
var prevOutTxId = [].reverse.call(new Buffer(transaction.ins[input.vout].hash)).toString('hex') var prevOutTxId = new Buffer(transaction.ins[input.vout].hash).reverse().toString('hex')
var prevVout = transaction.ins[input.vout].index var prevVout = transaction.ins[input.vout].index
tasks.push(function (callback) { tasks.push(function (callback) {

View file

@ -95,7 +95,7 @@ describe('TransactionBuilder', function () {
var tx = new Transaction() var tx = new Transaction()
f.inputs.forEach(function (input) { f.inputs.forEach(function (input) {
var txHash = [].reverse.call(new Buffer(input.txId, 'hex')) var txHash = new Buffer(input.txId, 'hex').reverse()
tx.addInput(txHash, input.vout, undefined, bscript.fromASM(input.scriptSig)) tx.addInput(txHash, input.vout, undefined, bscript.fromASM(input.scriptSig))
}) })