From bbe8943bf47bade7fc8823389420ec6d5a4f39e4 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 5 Jul 2016 12:14:26 -0700 Subject: [PATCH] minor. --- lib/bcoin/env.js | 3 ++- lib/bcoin/txdb.js | 1 + lib/bcoin/utils.js | 6 +++--- lib/bcoin/walletdb.js | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/bcoin/env.js b/lib/bcoin/env.js index 1c2bb249..fc8cf02f 100644 --- a/lib/bcoin/env.js +++ b/lib/bcoin/env.js @@ -133,7 +133,6 @@ function Environment() { this.errors = require('./errors'); this.ldb = require('./ldb'); this.timedata = require('./timedata'); - this.sigcache = require('./sigcache')(0); this.script = require('./script'); this.opcode = this.script.Opcode; this.stack = this.script.Stack; @@ -177,10 +176,12 @@ function Environment() { this.http = require('./http'); this.workers = require('./workers'); + this.sigcache = require('./sigcache')(0); this.time = new this.timedata(); this.defaultLogger = new this.logger('none'); this.useWorkers = false; this.workerPool = new this.workers(); + this.master = null; this.set({ network: process.env.BCOIN_NETWORK || 'main', diff --git a/lib/bcoin/txdb.js b/lib/bcoin/txdb.js index cd577b48..4ed89df4 100644 --- a/lib/bcoin/txdb.js +++ b/lib/bcoin/txdb.js @@ -58,6 +58,7 @@ function TXDB(db, options) { this.walletdb = db; this.db = db.db; this.logger = db.logger; + this.network = db.network; this.options = options; this.network = bcoin.network.get(options.network); this.busy = false; diff --git a/lib/bcoin/utils.js b/lib/bcoin/utils.js index 8aabed6b..c6483cbc 100644 --- a/lib/bcoin/utils.js +++ b/lib/bcoin/utils.js @@ -2506,13 +2506,13 @@ utils.binarySearch = function binarySearch(items, key, compare, insert) { * @param {Array} items * @param {Object} item * @param {Function} compare - * @returns {Number} Length. + * @returns {Number} index */ utils.binaryInsert = function binaryInsert(items, item, compare) { var i = utils.binarySearch(items, item, compare, true); items.splice(i, 0, item); - return items.length; + return i; }; /** @@ -2520,7 +2520,7 @@ utils.binaryInsert = function binaryInsert(items, item, compare) { * @param {Array} items * @param {Object} item * @param {Function} compare - * @returns {Number} Length. + * @returns {Boolean} */ utils.binaryRemove = function binaryRemove(items, item, compare) { diff --git a/lib/bcoin/walletdb.js b/lib/bcoin/walletdb.js index ee0d9eb4..54961a5b 100644 --- a/lib/bcoin/walletdb.js +++ b/lib/bcoin/walletdb.js @@ -63,7 +63,6 @@ function WalletDB(options) { }); this.tx = new bcoin.txdb(this, { - network: this.network, verify: this.options.verify, useFilter: true });