Skip to content

Commit

Permalink
Crownify
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanzhenzhen committed Nov 17, 2017
1 parent db40d26 commit d9c35ff
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion benchmarks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bitcoind.on('ready', function() {

var client = new bitcoin.Client({
host: 'localhost',
port: 18332,
port: 19341,
user: 'bitcoin',
pass: 'local321'
});
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/scaffold/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/scaffold/default-base-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/scaffold/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion lib/scaffold/find-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/scaffold/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/scaffold/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
2 changes: 1 addition & 1 deletion lib/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
32 changes: 16 additions & 16 deletions lib/services/bitcoind.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -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();
});
});
Expand All @@ -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;
};
Expand Down Expand Up @@ -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));
}
});
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
],
"bin": {
"bitcore-node": "./bin/bitcore-node",
"bitcore-node-crown": "./bin/bitcore-node-crown",
"bitcoind": "./bin/bitcoind"
},
"scripts": {
Expand Down

0 comments on commit d9c35ff

Please sign in to comment.