diff --git a/lib/errors.js b/lib/errors.js index 420e4fc1..0a1b6a42 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -15,14 +15,11 @@ Consensus.BlockExists = createError('BlockExists', Consensus); var Transaction = createError('Transaction', BitcoreNodeError); Transaction.NotFound = createError('NotFound', Transaction); -var Cancellation = createError('Cancellation', BitcoreNodeError); - module.exports = { Error: BitcoreNodeError, NoOutputs: NoOutputs, NoOutput: NoOutput, Wallet: Wallet, Consensus: Consensus, - Transaction: Transaction, - Cancellation: Cancellation + Transaction: Transaction }; diff --git a/lib/node.js b/lib/node.js index 6a30ea41..6309da6c 100644 --- a/lib/node.js +++ b/lib/node.js @@ -22,7 +22,6 @@ function Node(config) { this.network = null; this.services = {}; this._unloadedServices = []; - this.started = false; // TODO type check the arguments of config.services if (config.services) { @@ -187,24 +186,16 @@ Node.prototype.start = function(callback) { self._startService(service, next); }, function(err) { - if (err instanceof errors.Cancellation) { - self.cancellation = true; - return callback(err); - } else if (err) { + if (err) { return callback(err); } self.emit('ready'); - self.started = true; callback(); } ); }; Node.prototype.stop = function(callback) { - if (!this.started && !this.cancellation) { - this.pendingStop = true; - return; - } log.info('Beginning shutdown'); var self = this; var services = this.getServiceOrder().reverse(); diff --git a/lib/scaffold/start.js b/lib/scaffold/start.js index 1f193518..8c5f1629 100644 --- a/lib/scaffold/start.js +++ b/lib/scaffold/start.js @@ -216,10 +216,7 @@ function start(options) { }); node.start(function(err) { - if (err instanceof errors.Cancellation) { - log.warn('Cancelled start up of all services'); - start.cleanShutdown(process, node); - } else if(err) { + if(err) { log.error('Failed to start services'); if (err.stack) { log.error(err.stack); diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index 8f5b7f10..bda56272 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -159,10 +159,6 @@ Bitcoin.prototype.start = function(callback) { } if (self._reindex) { var interval = setInterval(function() { - if (self.node.pendingStop) { - clearInterval(interval); - return callback(new errors.Cancellation(), false); - } var percentSynced = bindings.syncPercentage(); log.info("Bitcoin Core Daemon Reindex Percentage: " + percentSynced); if (percentSynced >= 100) { diff --git a/test/node.unit.js b/test/node.unit.js index 4216b8cc..6593f7b5 100644 --- a/test/node.unit.js +++ b/test/node.unit.js @@ -324,7 +324,6 @@ describe('Bitcore Node', function() { describe('#stop', function() { it('will call stop for each service', function(done) { var node = new Node(baseConfig); - node.started = true; function TestService() {} util.inherits(TestService, BaseService); TestService.prototype.stop = sinon.stub().callsArg(0);