Allow zero config in blockchain

This commit is contained in:
Anthony Laibe 2018-08-23 15:29:39 +01:00
parent fa551f67a3
commit 23f7ec396a
5 changed files with 20 additions and 11 deletions

View File

@ -3,6 +3,7 @@ const constants = require('../../constants');
const path = require('path');
const utils = require('../../utils/utils');
let processCount = 1;
class ProcessLauncher {
/**
@ -15,7 +16,14 @@ class ProcessLauncher {
*/
constructor(options) {
this.name = path.basename(options.modulePath);
if (this._isDebug()) {
const childOptions = {stdio: 'pipe', execArgv: ['--inspect-brk=' + (60000 + processCount)]};
processCount++;
this.process = child_process.fork(options.modulePath, [], childOptions);
} else {
this.process = child_process.fork(options.modulePath);
}
this.logger = options.logger;
this.events = options.events;
this.silent = options.silent;
@ -25,6 +33,11 @@ class ProcessLauncher {
this._subscribeToMessages();
}
_isDebug() {
const argvString= process.execArgv.join();
return argvString.includes('--debug') || argvString.includes('--inspect');
}
// Subscribes to messages from the child process and delegates to the right methods
_subscribeToMessages() {
const self = this;

View File

@ -82,7 +82,7 @@ class BlockchainConnector {
if (!networkId && constants.blockchain.networkIds[self.blockchainConfig.networkType]) {
networkId = constants.blockchain.networkIds[self.blockchainConfig.networkType];
}
if (id.toString() !== networkId.toString()) {
if (networkId && id.toString() !== networkId.toString()) {
self.logger.warn(__('Connected to a blockchain node on network {{realId}} while your config specifies {{configId}}', {realId: id, configId: networkId}));
self.logger.warn(__('Make sure you started the right blockchain node'));
}

View File

@ -155,7 +155,7 @@ Blockchain.prototype.run = function() {
}
], function (err, cmd, args) {
if (err) {
console.error(err);
console.error(err.message);
return;
}
args = utils.compact(args);

View File

@ -217,11 +217,7 @@ class ENS {
"ENS": {
"deploy": false,
"silent": true
}
}
},
"development": {
"contracts": {
"ENSRegistry": {
"deploy": true,
"silent": true,
@ -285,7 +281,7 @@ class ENS {
if (this.registration && this.registration.rootDomain) {
// Register root domain if it is defined
const rootNode = namehash.hash(this.registration.rootDomain);
config.development.contracts['FIFSRegistrar'] = {
config.default.contracts['FIFSRegistrar'] = {
"deploy": true,
"silent": true,
"args": ["$ENSRegistry", rootNode],