From c3774261b4e89d0d8abfaae63d66583868b23d1a Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 17 Jun 2016 16:25:27 -0700 Subject: [PATCH] minor optimizations. --- lib/bcoin/block.js | 4 ++-- lib/bcoin/peer.js | 2 +- lib/bcoin/tx.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/bcoin/block.js b/lib/bcoin/block.js index 8e9b33c7..a3c36cae 100644 --- a/lib/bcoin/block.js +++ b/lib/bcoin/block.js @@ -235,8 +235,8 @@ Block.prototype.getBaseSize = function getBaseSize() { Block.prototype.hasWitness = function hasWitness() { var i; - if (this._witnessSize > 0) - return true; + if (this._witnessSize != null) + return this._witnessSize !== 0; for (i = 0; i < this.txs.length; i++) { if (this.txs[i].hasWitness()) diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index fcd69bad..cf0684f8 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -1892,7 +1892,7 @@ NetworkAddress.prototype.fromOptions = function fromOptions(options) { }; NetworkAddress.fromOptions = function fromOptions(options) { - return NetworkAddress().fromOptions(options); + return new NetworkAddress().fromOptions(options); }; /** diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index 38b69342..123fda52 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -399,8 +399,8 @@ TX.prototype.getBaseSize = function getBaseSize() { TX.prototype.hasWitness = function hasWitness() { var i; - if (this._witnessSize > 0) - return true; + if (this._witnessSize != null) + return this._witnessSize !== 0; for (i = 0; i < this.inputs.length; i++) { if (this.inputs[i].witness.items.length > 0)