tests: use safe-buffers throughout
This commit is contained in:
parent
aeb0312d63
commit
f1ab151c31
20 changed files with 88 additions and 94 deletions
test/integration
|
@ -15,7 +15,7 @@ describe('bitcoinjs-lib (advanced)', function () {
|
|||
if (err) return done(err)
|
||||
|
||||
var tx = new bitcoin.TransactionBuilder(network)
|
||||
var data = new Buffer('bitcoinjs-lib')
|
||||
var data = Buffer.from('bitcoinjs-lib')
|
||||
var dataScript = bitcoin.script.nullData.output.encode(data)
|
||||
|
||||
tx.addInput(unspent.txId, unspent.vout)
|
||||
|
|
|
@ -8,7 +8,7 @@ var blockchain = require('./_blockchain')
|
|||
describe('bitcoinjs-lib (basic)', function () {
|
||||
it('can generate a random bitcoin address', function () {
|
||||
// for testing only
|
||||
function rng () { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||
function rng () { return Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||
|
||||
// generate random keyPair
|
||||
var keyPair = bitcoin.ECPair.makeRandom({ rng: rng })
|
||||
|
@ -29,7 +29,7 @@ describe('bitcoinjs-lib (basic)', function () {
|
|||
|
||||
it('can generate a random keypair for alternative networks', function () {
|
||||
// for testing only
|
||||
function rng () { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||
function rng () { return Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||
|
||||
var litecoin = bitcoin.networks.litecoin
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('bitcoinjs-lib (BIP32)', function () {
|
|||
|
||||
var d1 = child.keyPair.d
|
||||
var d2
|
||||
var data = new Buffer(37)
|
||||
var data = Buffer.alloc(37)
|
||||
serQP.copy(data, 0)
|
||||
|
||||
// search index space until we find it
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('bitcoinjs-lib (crypto)', function () {
|
|||
|
||||
assert(bitcoin.script.pubKeyHash.input.check(scriptChunks), 'Expected pubKeyHash script')
|
||||
|
||||
var prevOutTxId = new Buffer(transaction.ins[input.vout].hash).reverse().toString('hex')
|
||||
var prevOutTxId = Buffer.from(transaction.ins[input.vout].hash).reverse().toString('hex')
|
||||
var prevVout = transaction.ins[input.vout].index
|
||||
|
||||
tasks.push(function (callback) {
|
||||
|
|
|
@ -12,7 +12,7 @@ describe('bitcoinjs-lib (multisig)', function () {
|
|||
'02c96db2302d19b43d4c69368babace7854cc84eb9e061cde51cfa77ca4a22b8b9',
|
||||
'03c6103b3b83e4a24a0e33a4df246ef11772f9992663db0c35759a5e2ebf68d8e9'
|
||||
].map(function (hex) {
|
||||
return new Buffer(hex, 'hex')
|
||||
return Buffer.from(hex, 'hex')
|
||||
})
|
||||
|
||||
var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys) // 2 of 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue