diff --git a/lib/services/p2p/bcoin.js b/lib/services/p2p/bcoin.js index 487a539ef..276103706 100644 --- a/lib/services/p2p/bcoin.js +++ b/lib/services/p2p/bcoin.js @@ -35,8 +35,9 @@ Bcoin.prototype.stop = function() { Bcoin.prototype._getConfig = function(options) { var config = { checkpoints: true, - network: options.network || 'main', - listen: true + network: options.bcoin_network || 'main', + listen: true, + logLevel: options.logLevel }; if (options.prefix) { config.prefix = options.prefix; diff --git a/lib/services/p2p/index.js b/lib/services/p2p/index.js index 14f49dae8..813a93a69 100644 --- a/lib/services/p2p/index.js +++ b/lib/services/p2p/index.js @@ -176,6 +176,7 @@ P2P.prototype._connect = function() { }; P2P.prototype._getBestHeight = function() { + if (this._peers === 0) { return 0; } @@ -285,7 +286,6 @@ P2P.prototype._onPeerReady = function(peer, addr) { }; - P2P.prototype._onPeerTx = function(peer, message) { var filteredMessage = this._applyMempoolFilter(message); if (filteredMessage) { @@ -332,9 +332,16 @@ P2P.prototype._setResourceFilter = function(filter, resource) { }; P2P.prototype._startBcoin = function() { + var logLevel; + if (process.env.BITCORE_ENV === 'debug') { + log.info('Debug mode detected, starting Bcoin logger'); + logLevel = 'info'; + } + this._bcoin = new Bcoin({ network: this.node.network, - prefix: this.node.datadir + prefix: this.node.datadir, + logLevel: logLevel, }); this._bcoin.start(); };