diff --git a/lib/bcoin/ldb.js b/lib/bcoin/ldb.js index 7d7fc71f..3b2c5a3c 100644 --- a/lib/bcoin/ldb.js +++ b/lib/bcoin/ldb.js @@ -96,11 +96,8 @@ function LowlevelUp(file, options) { // Stay as close to the metal as possible. // We want to make calls to C++ directly. - if (this.db.db && this.db.db.put) { + while (this.db.db && this.db.db.put) this.db = this.db.db; - if (this.db.db && this.db.db.put) - this.db = this.db.db; - } this.binding = this.db; this.hasBinding = false; diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index 505a81a9..d48e3fe5 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -1810,7 +1810,7 @@ Script.isMultisigInput = function isMultisigInput(code, keys, isWitness) { // it may look like multisig. This is // strange because it's technically a // recursive call. - if (Script.isScripthashInput(null, isWitness)) + if (Script.isScripthashInput(code, null, isWitness)) return false; if (code.length < 3) @@ -1895,11 +1895,10 @@ Script.prototype.getCoinbaseData = function getCoinbaseData() { script: this }; - if (Buffer.isBuffer(this.code[0]) && this.code[0].length <= 6) { + if (Buffer.isBuffer(this.code[0]) && this.code[0].length <= 6) coinbase.height = new bn(this.code[0], 'le').toNumber(); - } else { + else coinbase.height = -1; - } if (Buffer.isBuffer(this.code[1])) coinbase.extraNonce = new bn(this.code[1], 'le'); @@ -1911,11 +1910,12 @@ Script.prototype.getCoinbaseData = function getCoinbaseData() { }); coinbase.flags = flags; - coinbase.text = - flags.map(function(flag) { - return flag.toString('utf8'); - }).join('') - .replace(/[\u0000-\u0019\u007f-\u00ff]/g, ''); + + flags = flags.map(function(flag) { + return flag.toString('utf8'); + }); + + coinbase.text = flags.join('').replace(/[\u0000-\u0019\u007f-\u00ff]/g, ''); return coinbase; }; @@ -2214,9 +2214,9 @@ Script.prototype.isPushOnly = function isPushOnly() { }; Script.prototype.getSigops = function getSigops(accurate) { - var i, op; var total = 0; var lastOp = -1; + var i, op; for (i = 0; i < this.code.length; i++) { op = this.code[i]; diff --git a/lib/bcoin/utils.js b/lib/bcoin/utils.js index 9ce5b2be..e1609721 100644 --- a/lib/bcoin/utils.js +++ b/lib/bcoin/utils.js @@ -773,7 +773,7 @@ utils.array2ip = function array2ip(ip, version) { ip = utils.ip2version(ip, version); if (version === 4) - return Array.prototype.slice.call(ip).join('.'); + return ip[0] + '.' + ip[1] + '.' + ip[2] + '.' + ip[3]; if (version === 6) { out = [];