minor optimizations.

This commit is contained in:
Christopher Jeffrey 2016-06-17 16:25:27 -07:00
parent 7862418ccc
commit c3774261b4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 5 additions and 5 deletions

View File

@ -235,8 +235,8 @@ Block.prototype.getBaseSize = function getBaseSize() {
Block.prototype.hasWitness = function hasWitness() { Block.prototype.hasWitness = function hasWitness() {
var i; var i;
if (this._witnessSize > 0) if (this._witnessSize != null)
return true; return this._witnessSize !== 0;
for (i = 0; i < this.txs.length; i++) { for (i = 0; i < this.txs.length; i++) {
if (this.txs[i].hasWitness()) if (this.txs[i].hasWitness())

View File

@ -1892,7 +1892,7 @@ NetworkAddress.prototype.fromOptions = function fromOptions(options) {
}; };
NetworkAddress.fromOptions = function fromOptions(options) { NetworkAddress.fromOptions = function fromOptions(options) {
return NetworkAddress().fromOptions(options); return new NetworkAddress().fromOptions(options);
}; };
/** /**

View File

@ -399,8 +399,8 @@ TX.prototype.getBaseSize = function getBaseSize() {
TX.prototype.hasWitness = function hasWitness() { TX.prototype.hasWitness = function hasWitness() {
var i; var i;
if (this._witnessSize > 0) if (this._witnessSize != null)
return true; return this._witnessSize !== 0;
for (i = 0; i < this.inputs.length; i++) { for (i = 0; i < this.inputs.length; i++) {
if (this.inputs[i].witness.items.length > 0) if (this.inputs[i].witness.items.length > 0)