From 2f93137767d207400d80bbf4fb89936eb10d7274 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 26 Dec 2017 15:57:28 -0300 Subject: [PATCH 1/2] fix bcmonitor startup --- lib/blockchainmonitor.js | 2 +- lib/storage.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/blockchainmonitor.js b/lib/blockchainmonitor.js index 3a008ac34..0f15cb8a8 100644 --- a/lib/blockchainmonitor.js +++ b/lib/blockchainmonitor.js @@ -223,7 +223,7 @@ BlockchainMonitor.prototype._updateAddressesWithBalance = function(address, cb) } addresses.push(address.address); - log.info('Activating address '+address); + log.info('Activating address ' + address.address); self.storage.storeAddressesWithBalance(address.walletId, addresses, function(err) { if (err) { log.warn('Could not update wallet cache', err); diff --git a/lib/storage.js b/lib/storage.js index f1be1b9c4..10b3f6ac0 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -228,6 +228,7 @@ Storage.prototype._completeTxData = function(walletId, txs, cb) { // TODO: remove walletId from signature Storage.prototype.fetchTx = function(walletId, txProposalId, cb) { var self = this; + if (!this.db) return cb(); this.db.collection(collections.TXS).findOne({ id: txProposalId, @@ -241,6 +242,7 @@ Storage.prototype.fetchTx = function(walletId, txProposalId, cb) { Storage.prototype.fetchTxByHash = function(hash, cb) { var self = this; + if (!this.db) return; this.db.collection(collections.TXS).findOne({ txid: hash, @@ -542,6 +544,7 @@ Storage.prototype.fetchAddressByWalletId = function(walletId, address, cb) { Storage.prototype.fetchAddressByCoin = function(coin, address, cb) { var self = this; + if (!this.db) return cb(); this.db.collection(collections.ADDRESSES).find({ address: address, From 35d1fc3e12b6f8ed524a2717dd29e2b1d3e8cc22 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 26 Dec 2017 16:03:36 -0300 Subject: [PATCH 2/2] fix --- lib/storage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/storage.js b/lib/storage.js index 10b3f6ac0..a966f91bc 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -242,7 +242,7 @@ Storage.prototype.fetchTx = function(walletId, txProposalId, cb) { Storage.prototype.fetchTxByHash = function(hash, cb) { var self = this; - if (!this.db) return; + if (!this.db) return cb(); this.db.collection(collections.TXS).findOne({ txid: hash,