fix testnet

This commit is contained in:
Jonathan Rainville 2018-05-22 15:36:31 -04:00
parent 4bdf469131
commit ece09785a7

View File

@ -95,7 +95,6 @@ Blockchain.prototype.run = function() {
}, },
function getMainCommand(next) { function getMainCommand(next) {
self.client.mainCommand(address, function(cmd) { self.client.mainCommand(address, function(cmd) {
console.log(cmd);
next(null, cmd); next(null, cmd);
}); });
} }
@ -136,14 +135,16 @@ Blockchain.prototype.isClientInstalled = function(callback) {
Blockchain.prototype.initChainAndGetAddress = function(callback) { Blockchain.prototype.initChainAndGetAddress = function(callback) {
const self = this; const self = this;
var address = null, result; let address = null;
// ensure datadir exists, bypassing the interactive liabilities prompt. // ensure datadir exists, bypassing the interactive liabilities prompt.
self.datadir = '.embark/' + self.env + '/datadir'; self.datadir = '.embark/' + self.env + '/datadir';
async.waterfall([ async.waterfall([
function makeDir(next) { function makeDir(next) {
fs.mkdirp(self.datadir, next); fs.mkdirp(self.datadir, (err, _result) => {
next(err);
});
}, },
function copy(next) { function copy(next) {
// copy mining script // copy mining script
@ -154,11 +155,10 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) {
if (err || stderr || stdout === undefined || stdout.match(/{(\w+)}/) === null || stdout.indexOf("Fatal") >= 0) { if (err || stderr || stdout === undefined || stdout.match(/{(\w+)}/) === null || stdout.indexOf("Fatal") >= 0) {
console.log(__("no accounts found").green); console.log(__("no accounts found").green);
return next(); return next();
} else {
console.log(__("already initialized").green);
address = result.output.match(/{(\w+)}/)[1];
} }
console.log(__("already initialized").green);
address = stdout.match(/{(\w+)}/)[1];
next();
}); });
}, },
function genesisBlock(next) { function genesisBlock(next) {
@ -171,11 +171,12 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) {
}); });
}, },
function newAccount(next) { function newAccount(next) {
result = self.runCommand(self.client.newAccountCommand(), {}, (err, stdout, _stderr) => { self.runCommand(self.client.newAccountCommand(), {}, (err, stdout, _stderr) => {
if (err) { if (err) {
return next(err); return next(err);
} }
address = stdout.match(/{(\w+)}/)[1]; address = stdout.match(/{(\w+)}/)[1];
next();
}); });
} }
], (err) => { ], (err) => {