diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index e7314fc9..0a1e43cb 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -55,7 +55,12 @@ var Blockchain = function(options) { Blockchain.prototype.runCommand = function(cmd, options) { console.log(("running: " + cmd.underline).green); - return shelljs.exec(cmd, options); + return shelljs.exec(cmd, options, (err, stdout, _stderr) => { + if (err && this.env === 'development' && stdout.indexOf('Failed to unlock developer account') > 0) { + console.warn('\nDevelopment blockchain changed to use the --dev option.'.yellow); + console.warn('You will need to change your data directory in blockchain.json (datadir)'.yellow); + } + }); }; Blockchain.prototype.run = function() { @@ -69,7 +74,10 @@ Blockchain.prototype.run = function() { console.log(("could not find " + this.config.geth_bin + " command; is " + this.client.name + " installed or in the PATH?").green); return; } - var address = this.initChainAndGetAddress(); + let address = ''; + if (self.env !== "development") { + address = this.initChainAndGetAddress(); + } this.client.mainCommand(address, function(cmd) { self.runCommand(cmd, {async: true}); }); diff --git a/lib/cmds/blockchain/geth_commands.js b/lib/cmds/blockchain/geth_commands.js index 151b3267..c7e7dd2c 100644 --- a/lib/cmds/blockchain/geth_commands.js +++ b/lib/cmds/blockchain/geth_commands.js @@ -123,6 +123,7 @@ class GethCommands { let config = this.config; let rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']); let ws_api = (this.config.wsApi || ['eth', 'web3', 'net']); + const isDev = self.env === 'development'; async.series([ function commonOptions(callback) { @@ -188,7 +189,7 @@ class GethCommands { } else { accountAddress = address; } - if (accountAddress) { + if (accountAddress && !isDev) { return callback(null, "--unlock=" + accountAddress); } callback(null, ""); @@ -200,10 +201,16 @@ class GethCommands { callback(null, ""); }, function mineWhenNeeded(callback) { - if (config.mineWhenNeeded) { + if (config.mineWhenNeeded && !isDev) { return callback(null, "js .embark/" + self.env + "/js/mine.js"); } callback(null, ""); + }, + function isDev(callback) { + if (isDev) { + return callback(null, '--dev'); + } + callback(null, ''); } ], function (err, results) { if (err) {