Browse Source

Switching deprecated buffer constructor to use Buffer.from

patch-2
Micah Riggan 7 years ago
parent
commit
df5fcf2332
No known key found for this signature in database GPG Key ID: 1DF0722D8116EE83
  1. 5
      lib/address.js
  2. 2
      lib/transaction/transaction.js

5
lib/address.js

@ -463,9 +463,8 @@ Address.prototype.isPayToScriptHash = function() {
* @returns {Buffer} Bitcoin address buffer
*/
Address.prototype.toBuffer = function() {
var version = new Buffer([this.network[this.type]]);
var buf = Buffer.concat([version, this.hashBuffer]);
return buf;
var version = Buffer.from([this.network[this.type]]);
return Buffer.concat([version, this.hashBuffer]);
};
/**

2
lib/transaction/transaction.js

@ -474,7 +474,7 @@ Transaction.prototype.getLockTime = function() {
};
Transaction.prototype.fromString = function(string) {
this.fromBuffer(new buffer.Buffer(string, 'hex'));
this.fromBuffer(buffer.Buffer.from(string, 'hex'));
};
Transaction.prototype._newTransaction = function() {

Loading…
Cancel
Save