From d9c35ff410610504bafdd0bc8bda3378b3a902b1 Mon Sep 17 00:00:00 2001 From: Zhenzhen Zhan Date: Sat, 18 Nov 2017 01:18:54 +0800 Subject: [PATCH] Crownify --- benchmarks/index.js | 2 +- bin/{bitcore-node => bitcore-node-crown} | 0 lib/scaffold/create.js | 2 +- lib/scaffold/default-base-config.js | 2 +- lib/scaffold/default-config.js | 2 +- lib/scaffold/find-config.js | 2 +- lib/scaffold/remove.js | 4 +-- lib/scaffold/start.js | 2 +- lib/service.js | 2 +- lib/services/bitcoind.js | 32 ++++++++++++------------ package.json | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) rename bin/{bitcore-node => bitcore-node-crown} (100%) diff --git a/benchmarks/index.js b/benchmarks/index.js index 71e308640..7a226479f 100644 --- a/benchmarks/index.js +++ b/benchmarks/index.js @@ -52,7 +52,7 @@ bitcoind.on('ready', function() { var client = new bitcoin.Client({ host: 'localhost', - port: 18332, + port: 19341, user: 'bitcoin', pass: 'local321' }); diff --git a/bin/bitcore-node b/bin/bitcore-node-crown similarity index 100% rename from bin/bitcore-node rename to bin/bitcore-node-crown diff --git a/lib/scaffold/create.js b/lib/scaffold/create.js index 5f53de68d..f4c20d5ec 100644 --- a/lib/scaffold/create.js +++ b/lib/scaffold/create.js @@ -103,7 +103,7 @@ function create(options, done) { async.series([ function(next) { - // Setup the the bitcore-node directory and configuration + // Setup the the bitcore-node-crown directory and configuration if (!fs.existsSync(absConfigDir)) { var createOptions = { network: options.network, diff --git a/lib/scaffold/default-base-config.js b/lib/scaffold/default-base-config.js index 1f584b55a..fecfdefed 100644 --- a/lib/scaffold/default-base-config.js +++ b/lib/scaffold/default-base-config.js @@ -3,7 +3,7 @@ var path = require('path'); /** - * Will return the path and default bitcore-node configuration on environment variables + * Will return the path and default bitcore-node-crown configuration on environment variables * or default locations. * @param {Object} options * @param {String} options.network - "testnet" or "livenet" diff --git a/lib/scaffold/default-config.js b/lib/scaffold/default-config.js index c765af6e6..f66eb9d94 100644 --- a/lib/scaffold/default-config.js +++ b/lib/scaffold/default-config.js @@ -5,7 +5,7 @@ var mkdirp = require('mkdirp'); var fs = require('fs'); /** - * Will return the path and default bitcore-node configuration. It will search for the + * Will return the path and default bitcore-node-dash configuration. It will search for the * configuration file in the "~/.bitcore-crown" directory, and if it doesn't exist, it will create one * based on default settings. * @param {Object} [options] diff --git a/lib/scaffold/find-config.js b/lib/scaffold/find-config.js index b8a10aaed..cc9031ea8 100644 --- a/lib/scaffold/find-config.js +++ b/lib/scaffold/find-config.js @@ -8,7 +8,7 @@ var fs = require('fs'); var utils = require('../utils'); /** - * Will return the path and bitcore-node configuration + * Will return the path and bitcore-node-crown configuration * @param {String} cwd - The absolute path to the current working directory */ function findConfig(cwd) { diff --git a/lib/scaffold/remove.js b/lib/scaffold/remove.js index 339bab592..02144c94d 100644 --- a/lib/scaffold/remove.js +++ b/lib/scaffold/remove.js @@ -82,9 +82,9 @@ function removeService(configDir, service, done) { } /** - * Will remove the Node.js service and from the bitcore-node configuration. + * Will remove the Node.js service and from the bitcore-node-crown configuration. * @param {String} options.cwd - The current working directory - * @param {String} options.dirname - The bitcore-node configuration directory + * @param {String} options.dirname - The bitcore-node-crown configuration directory * @param {Array} options.services - An array of strings of service names * @param {Function} done - A callback function called when finished */ diff --git a/lib/scaffold/start.js b/lib/scaffold/start.js index 334f0af10..a7d012c61 100644 --- a/lib/scaffold/start.js +++ b/lib/scaffold/start.js @@ -135,7 +135,7 @@ function checkService(service) { */ function loadModule(req, service) { try { - // first try in the built-in bitcore-node services directory + // first try in the built-in bitcore-node-crown services directory service.module = req(path.resolve(__dirname, '../services/' + service.name)); } catch(e) { diff --git a/lib/service.js b/lib/service.js index 08d0ef5a2..fcb2edd72 100644 --- a/lib/service.js +++ b/lib/service.js @@ -68,7 +68,7 @@ Service.prototype.start = function(done) { }; /** - * Function to be called when bitcore-node is stopped + * Function to be called when bitcore-node-crown is stopped */ Service.prototype.stop = function(done) { setImmediate(done); diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index cc32638d4..293fd4715 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -374,21 +374,21 @@ Bitcoin.prototype._loadSpawnConfiguration = function(node) { Bitcoin.prototype._checkConfigIndexes = function(spawnConfig, node) { $.checkState( spawnConfig.txindex && spawnConfig.txindex === 1, - '"txindex" option is required in order to use transaction query features of bitcore-node. ' + + '"txindex" option is required in order to use transaction query features of bitcore-node-crown. ' + 'Please add "txindex=1" to your configuration and reindex an existing database if ' + 'necessary with reindex=1' ); $.checkState( spawnConfig.addressindex && spawnConfig.addressindex === 1, - '"addressindex" option is required in order to use address query features of bitcore-node. ' + + '"addressindex" option is required in order to use address query features of bitcore-node-crown. ' + 'Please add "addressindex=1" to your configuration and reindex an existing database if ' + 'necessary with reindex=1' ); $.checkState( spawnConfig.spentindex && spawnConfig.spentindex === 1, - '"spentindex" option is required in order to use spent info query features of bitcore-node. ' + + '"spentindex" option is required in order to use spent info query features of bitcore-node-crown. ' + 'Please add "spentindex=1" to your configuration and reindex an existing database if ' + 'necessary with reindex=1' ); @@ -420,7 +420,7 @@ Bitcoin.prototype._checkConfigIndexes = function(spawnConfig, node) { log.warn('Reindex option is currently enabled. This means that bitcoind is undergoing a reindex. ' + 'The reindex flag will start the index from beginning every time the node is started, so it ' + 'should be removed after the reindex has been initiated. Once the reindex is complete, the rest ' + - 'of bitcore-node services will start.'); + 'of bitcore-node-crown services will start.'); node._reindex = true; } }; @@ -477,7 +477,7 @@ Bitcoin.prototype._initChain = function(callback) { } self.genesisBuffer = blockBuffer; self.emit('ready'); - log.info('Bitcoin Daemon Ready'); + log.info('Crown Daemon Ready'); callback(); }); }); @@ -488,10 +488,10 @@ Bitcoin.prototype._initChain = function(callback) { Bitcoin.prototype._getDefaultConf = function() { var networkOptions = { - rpcport: 8332 + rpcport: 9341 }; if (this.node.network === bitcore.Networks.testnet) { - networkOptions.rpcport = 18332; + networkOptions.rpcport = 19341; } return networkOptions; }; @@ -581,7 +581,7 @@ Bitcoin.prototype._updateTip = function(node, message) { if (Math.round(percentage) >= 100) { self.emit('synced', self.height); } - log.info('Bitcoin Height:', self.height, 'Percentage:', percentage.toFixed(2)); + log.info('Crown Height:', self.height, 'Percentage:', percentage.toFixed(2)); } }); } @@ -758,7 +758,7 @@ Bitcoin.prototype._checkReindex = function(node, callback) { } var percentSynced = response.result.verificationprogress * 100; - log.info('Bitcoin Core Daemon Reindex Percentage: ' + percentSynced.toFixed(2)); + log.info('Crown Core Daemon Reindex Percentage: ' + percentSynced.toFixed(2)); if (Math.round(percentSynced) >= 100) { node._reindex = false; @@ -811,11 +811,11 @@ Bitcoin.prototype._stopSpawnedBitcoin = function(callback) { return callback(null); } try { - log.warn('Stopping existing spawned bitcoin process with pid: ' + pid); + log.warn('Stopping existing spawned crown process with pid: ' + pid); self._process.kill(pid, 'SIGINT'); } catch(err) { if (err && err.code === 'ESRCH') { - log.warn('Unclean bitcoin process shutdown, process not found with pid: ' + pid); + log.warn('Unclean crown process shutdown, process not found with pid: ' + pid); return callback(null); } else if(err) { return callback(err); @@ -857,7 +857,7 @@ Bitcoin.prototype._spawnChildProcess = function(callback) { return callback(err); } - log.info('Starting bitcoin process'); + log.info('Starting crown process'); self.spawn.process = spawn(self.spawn.exec, options, {stdio: 'inherit'}); self.spawn.process.on('error', function(err) { @@ -866,14 +866,14 @@ Bitcoin.prototype._spawnChildProcess = function(callback) { self.spawn.process.once('exit', function(code) { if (!self.node.stopping) { - log.warn('Bitcoin process unexpectedly exited with code:', code); - log.warn('Restarting bitcoin child process in ' + self.spawnRestartTime + 'ms'); + log.warn('Crown process unexpectedly exited with code:', code); + log.warn('Restarting crown child process in ' + self.spawnRestartTime + 'ms'); setTimeout(function() { self._spawnChildProcess(function(err) { if (err) { return self.emit('error', err); } - log.warn('Bitcoin process restarted'); + log.warn('Crown process restarted'); }); }, self.spawnRestartTime); } @@ -1347,7 +1347,7 @@ Bitcoin.prototype._getAddressDetailsForTransaction = function(transaction, addre /** * Will expand into a detailed transaction from a txid - * @param {Object} txid - A bitcoin transaction id + * @param {Object} txid - A crown transaction id * @param {Function} callback */ Bitcoin.prototype._getAddressDetailedTransaction = function(txid, options, next) { diff --git a/package.json b/package.json index 6b3a97470..966b43a6e 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ } ], "bin": { - "bitcore-node": "./bin/bitcore-node", + "bitcore-node-crown": "./bin/bitcore-node-crown", "bitcoind": "./bin/bitcoind" }, "scripts": {