Zcash-ify console output
This commit is contained in:
parent
112c6d896d
commit
3ecbe21697
|
@ -5,7 +5,7 @@ var bitcoin = require('bitcoin');
|
|||
var async = require('async');
|
||||
var maxTime = 20;
|
||||
|
||||
console.log('Bitcoin Service native interface vs. Bitcoin JSON RPC interface');
|
||||
console.log('Zcash Service native interface vs. Zcash JSON RPC interface');
|
||||
console.log('----------------------------------------------------------------------');
|
||||
|
||||
// To run the benchmarks a fully synced Bitcore Core directory is needed. The RPC comands
|
||||
|
@ -43,12 +43,12 @@ bitcoind.start(function(err) {
|
|||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
console.log('Bitcoin Core started');
|
||||
console.log('Zcash started');
|
||||
});
|
||||
|
||||
bitcoind.on('ready', function() {
|
||||
|
||||
console.log('Bitcoin Core ready');
|
||||
console.log('Zcash ready');
|
||||
|
||||
var client = new bitcoin.Client({
|
||||
host: 'localhost',
|
||||
|
|
|
@ -22,8 +22,8 @@ function checkConfigVersion2(fullConfig) {
|
|||
if (!datadirUndefined || addressDefined || dbDefined) {
|
||||
|
||||
console.warn('\nConfiguration file is not compatible with this version. \n' +
|
||||
'A reindex for bitcoind is necessary for this upgrade with the "reindex=1" bitcoin.conf option. \n' +
|
||||
'There are changes necessary in both bitcoin.conf and bitcore-node.json. \n\n' +
|
||||
'A reindex for zcashd is necessary for this upgrade with the "reindex=1" zcash.conf option. \n' +
|
||||
'There are changes necessary in both zcash.conf and bitcore-node.json. \n\n' +
|
||||
'To upgrade please see the details below and documentation at: \n' +
|
||||
'https://github.com/bitpay/bitcore-node/blob/bitcoind/docs/upgrade.md \n');
|
||||
|
||||
|
|
|
@ -331,16 +331,16 @@ Bitcoin.prototype._expandRelativeDatadir = function() {
|
|||
Bitcoin.prototype._loadSpawnConfiguration = function(node) {
|
||||
/* jshint maxstatements: 25 */
|
||||
|
||||
$.checkArgument(this.options.spawn, 'Please specify "spawn" in bitcoind config options');
|
||||
$.checkArgument(this.options.spawn.datadir, 'Please specify "spawn.datadir" in bitcoind config options');
|
||||
$.checkArgument(this.options.spawn.exec, 'Please specify "spawn.exec" in bitcoind config options');
|
||||
$.checkArgument(this.options.spawn, 'Please specify "spawn" in zcashd config options');
|
||||
$.checkArgument(this.options.spawn.datadir, 'Please specify "spawn.datadir" in zcashd config options');
|
||||
$.checkArgument(this.options.spawn.exec, 'Please specify "spawn.exec" in zcashd config options');
|
||||
|
||||
this._expandRelativeDatadir();
|
||||
|
||||
var spawnOptions = this.options.spawn;
|
||||
var configPath = path.resolve(spawnOptions.datadir, './zcash.conf');
|
||||
|
||||
log.info('Using bitcoin config file:', configPath);
|
||||
log.info('Using zcash config file:', configPath);
|
||||
|
||||
this.spawn = {};
|
||||
this.spawn.datadir = this.options.spawn.datadir;
|
||||
|
@ -395,29 +395,29 @@ Bitcoin.prototype._checkConfigIndexes = function(spawnConfig, node) {
|
|||
|
||||
$.checkState(
|
||||
spawnConfig.server && spawnConfig.server === 1,
|
||||
'"server" option is required to communicate to bitcoind from bitcore. ' +
|
||||
'"server" option is required to communicate to zcashd from bitcore. ' +
|
||||
'Please add "server=1" to your configuration and restart'
|
||||
);
|
||||
|
||||
$.checkState(
|
||||
spawnConfig.zmqpubrawtx,
|
||||
'"zmqpubrawtx" option is required to get event updates from bitcoind. ' +
|
||||
'"zmqpubrawtx" option is required to get event updates from zcashd. ' +
|
||||
'Please add "zmqpubrawtx=tcp://127.0.0.1:<port>" to your configuration and restart'
|
||||
);
|
||||
|
||||
$.checkState(
|
||||
spawnConfig.zmqpubhashblock,
|
||||
'"zmqpubhashblock" option is required to get event updates from bitcoind. ' +
|
||||
'"zmqpubhashblock" option is required to get event updates from zcashd. ' +
|
||||
'Please add "zmqpubhashblock=tcp://127.0.0.1:<port>" to your configuration and restart'
|
||||
);
|
||||
|
||||
$.checkState(
|
||||
(spawnConfig.zmqpubhashblock === spawnConfig.zmqpubrawtx),
|
||||
'"zmqpubrawtx" and "zmqpubhashblock" are expected to the same host and port in bitcoin.conf'
|
||||
'"zmqpubrawtx" and "zmqpubhashblock" are expected to the same host and port in zcash.conf'
|
||||
);
|
||||
|
||||
if (spawnConfig.reindex && spawnConfig.reindex === 1) {
|
||||
log.warn('Reindex option is currently enabled. This means that bitcoind is undergoing a reindex. ' +
|
||||
log.warn('Reindex option is currently enabled. This means that zcashd 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.');
|
||||
|
@ -477,7 +477,7 @@ Bitcoin.prototype._initChain = function(callback) {
|
|||
}
|
||||
self.genesisBuffer = blockBuffer;
|
||||
self.emit('ready');
|
||||
log.info('Bitcoin Daemon Ready');
|
||||
log.info('Zcash Daemon Ready');
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
@ -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('Zcash Height:', self.height, 'Percentage:', percentage.toFixed(2));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -759,7 +759,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('Zcash Daemon Reindex Percentage: ' + percentSynced.toFixed(2));
|
||||
|
||||
if (Math.round(percentSynced) >= 100) {
|
||||
node._reindex = false;
|
||||
|
@ -812,11 +812,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 zcash 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 zcash process shutdown, process not found with pid: ' + pid);
|
||||
return callback(null);
|
||||
} else if(err) {
|
||||
return callback(err);
|
||||
|
@ -858,7 +858,7 @@ Bitcoin.prototype._spawnChildProcess = function(callback) {
|
|||
return callback(err);
|
||||
}
|
||||
|
||||
log.info('Starting bitcoin process');
|
||||
log.info('Starting zcash process');
|
||||
self.spawn.process = spawn(self.spawn.exec, options, {stdio: 'inherit'});
|
||||
|
||||
self.spawn.process.on('error', function(err) {
|
||||
|
@ -867,14 +867,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('Zcash process unexpectedly exited with code:', code);
|
||||
log.warn('Restarting zcash 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('Zcash process restarted');
|
||||
});
|
||||
}, self.spawnRestartTime);
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ Bitcoin.prototype._spawnChildProcess = function(callback) {
|
|||
return callback(err);
|
||||
}
|
||||
if (exitShutdown) {
|
||||
return callback(new Error('Stopping while trying to spawn bitcoind.'));
|
||||
return callback(new Error('Stopping while trying to spawn zcashd.'));
|
||||
}
|
||||
|
||||
self._initZmqSubSocket(node, self.spawn.config.zmqpubrawtx);
|
||||
|
@ -949,7 +949,7 @@ Bitcoin.prototype._connectProcess = function(config, callback) {
|
|||
return callback(err);
|
||||
}
|
||||
if (exitShutdown) {
|
||||
return callback(new Error('Stopping while trying to connect to bitcoind.'));
|
||||
return callback(new Error('Stopping while trying to connect to zcashd.'));
|
||||
}
|
||||
|
||||
self._initZmqSubSocket(node, config.zmqpubrawtx);
|
||||
|
@ -1000,7 +1000,7 @@ Bitcoin.prototype.start = function(callback) {
|
|||
return callback(err);
|
||||
}
|
||||
if (self.nodes.length === 0) {
|
||||
return callback(new Error('Bitcoin configuration options "spawn" or "connect" are expected'));
|
||||
return callback(new Error('Zcash configuration options "spawn" or "connect" are expected'));
|
||||
}
|
||||
self._initChain(callback);
|
||||
});
|
||||
|
@ -2080,7 +2080,7 @@ Bitcoin.prototype.stop = function(callback) {
|
|||
if (!exited) {
|
||||
exited = true;
|
||||
if (code !== 0) {
|
||||
var error = new Error('bitcoind spawned process exited with status code: ' + code);
|
||||
var error = new Error('zcashd spawned process exited with status code: ' + code);
|
||||
error.code = code;
|
||||
return callback(error);
|
||||
} else {
|
||||
|
@ -2092,7 +2092,7 @@ Bitcoin.prototype.stop = function(callback) {
|
|||
setTimeout(function() {
|
||||
if (!exited) {
|
||||
exited = true;
|
||||
return callback(new Error('bitcoind process did not exit'));
|
||||
return callback(new Error('zcashd process did not exit'));
|
||||
}
|
||||
}, this.shutdownTimeout).unref();
|
||||
} else {
|
||||
|
|
|
@ -26,7 +26,7 @@ var coinbasePrivateKey;
|
|||
var privateKey = bitcore.PrivateKey();
|
||||
var destKey = bitcore.PrivateKey();
|
||||
|
||||
describe('Bitcoind Functionality', function() {
|
||||
describe('Zcashd Functionality', function() {
|
||||
|
||||
before(function(done) {
|
||||
this.timeout(60000);
|
||||
|
@ -60,10 +60,10 @@ describe('Bitcoind Functionality', function() {
|
|||
log.error('error="%s"', err.message);
|
||||
});
|
||||
|
||||
log.info('Waiting for Bitcoin Core to initialize...');
|
||||
log.info('Waiting for Zcash to initialize...');
|
||||
|
||||
bitcoind.start(function() {
|
||||
log.info('Bitcoind started');
|
||||
log.info('Zcashd started');
|
||||
|
||||
client = new BitcoinRPC({
|
||||
protocol: 'http',
|
||||
|
|
|
@ -63,13 +63,13 @@ describe('P2P Functionality', function() {
|
|||
log.error('error="%s"', err.message);
|
||||
});
|
||||
|
||||
log.info('Waiting for Bitcoin Core to initialize...');
|
||||
log.info('Waiting for Zcash to initialize...');
|
||||
|
||||
bitcoind.start(function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
log.info('Bitcoind started');
|
||||
log.info('Zcashd started');
|
||||
|
||||
client = new BitcoinRPC({
|
||||
protocol: 'http',
|
||||
|
|
Loading…
Reference in New Issue