remove remaning of accounts config in blockchain

This commit is contained in:
Jonathan Rainville 2018-05-18 09:34:59 -04:00
parent 6c8653ef09
commit a1e3c741a0
4 changed files with 12 additions and 13 deletions

View File

@ -7,7 +7,6 @@ var GethCommands = require('./geth_commands.js');
/*eslint complexity: ["error", 35]*/ /*eslint complexity: ["error", 35]*/
var Blockchain = function(options) { var Blockchain = function(options) {
this.blockchainConfig = options.blockchainConfig; this.blockchainConfig = options.blockchainConfig;
this.accountsConfig = options.accountsConfig;
this.env = options.env || 'development'; this.env = options.env || 'development';
this.client = options.client; this.client = options.client;
this.isDev = options.isDev; this.isDev = options.isDev;
@ -42,8 +41,7 @@ var Blockchain = function(options) {
vmdebug: this.blockchainConfig.vmdebug || false, vmdebug: this.blockchainConfig.vmdebug || false,
targetGasLimit: this.blockchainConfig.targetGasLimit || false, targetGasLimit: this.blockchainConfig.targetGasLimit || false,
light: this.blockchainConfig.light || false, light: this.blockchainConfig.light || false,
fast: this.blockchainConfig.fast || false, fast: this.blockchainConfig.fast || false
accountsConfig: this.accountsConfig
}; };
if (this.blockchainConfig === {} || JSON.stringify(this.blockchainConfig) === '{"enabled":true}') { if (this.blockchainConfig === {} || JSON.stringify(this.blockchainConfig) === '{"enabled":true}') {
@ -126,9 +124,9 @@ Blockchain.prototype.initChainAndGetAddress = function() {
return address; return address;
}; };
var BlockchainClient = function(blockchainConfig, accountsConfig, client, env, isDev) { var BlockchainClient = function(blockchainConfig, client, env, isDev) {
if (client === 'geth') { if (client === 'geth') {
return new Blockchain({blockchainConfig, accountsConfig, client: GethCommands, env, isDev}); return new Blockchain({blockchainConfig, client: GethCommands, env, isDev});
} else { } else {
throw new Error('unknown client'); throw new Error('unknown client');
} }

View File

@ -101,5 +101,8 @@
"downloading {{packageName}} {{version}}....": "downloading {{packageName}} {{version}}....", "downloading {{packageName}} {{version}}....": "downloading {{packageName}} {{version}}....",
"Swarm node is offline...": "Swarm node is offline...", "Swarm node is offline...": "Swarm node is offline...",
"Swarm node detected...": "Swarm node detected...", "Swarm node detected...": "Swarm node detected...",
"Ethereum node (version unknown)": "Ethereum node (version unknown)" "Ethereum node (version unknown)": "Ethereum node (version unknown)",
"No Blockchain node found": "No Blockchain node found",
"Couldn't connect to an Ethereum node are you sure it's on?": "Couldn't connect to an Ethereum node are you sure it's on?",
"make sure you have an Ethereum node or simulator running. e.g '%s'": "make sure you have an Ethereum node or simulator running. e.g '%s'"
} }

View File

@ -61,7 +61,7 @@ class Embark {
if(webServerConfig) blockchainConfig.wsOrigins = `http://${webServerConfig.host}:${webServerConfig.port}`; if(webServerConfig) blockchainConfig.wsOrigins = `http://${webServerConfig.host}:${webServerConfig.port}`;
if(storageConfig) blockchainConfig.wsOrigins += `${blockchainConfig.wsOrigins.length ? ',' : ''}${storageConfig.protocol}://${storageConfig.host}:${storageConfig.port}`; if(storageConfig) blockchainConfig.wsOrigins += `${blockchainConfig.wsOrigins.length ? ',' : ''}${storageConfig.protocol}://${storageConfig.host}:${storageConfig.port}`;
} }
return require('./cmds/blockchain/blockchain.js')(blockchainConfig, this.config.contractsConfig.deployment.accounts, client, env, this.isDev(env)).run(); return require('./cmds/blockchain/blockchain.js')(blockchainConfig, client, env, this.isDev(env)).run();
} }
simulator(options) { simulator(options) {

View File

@ -15,7 +15,6 @@ describe('embark.Blockchain', function () {
let config = { let config = {
networkType: 'custom', networkType: 'custom',
genesisBlock: false, genesisBlock: false,
accountsConfig: {},
geth_bin: 'geth', geth_bin: 'geth',
datadir: false, datadir: false,
mineWhenNeeded: false, mineWhenNeeded: false,
@ -32,7 +31,7 @@ describe('embark.Blockchain', function () {
whisper: true, whisper: true,
account: {}, account: {},
bootnodes: "", bootnodes: "",
wsApi: [ "eth", "web3", "net", "shh" ], wsApi: ["eth", "web3", "net", "shh"],
wsHost: "localhost", wsHost: "localhost",
wsOrigins: false, wsOrigins: false,
wsPort: 8546, wsPort: 8546,
@ -41,7 +40,7 @@ describe('embark.Blockchain', function () {
fast: false, fast: false,
light: false light: false
}; };
let blockchain = new Blockchain(config, {}, 'geth'); let blockchain = new Blockchain(config, 'geth');
assert.deepEqual(blockchain.config, config); assert.deepEqual(blockchain.config, config);
done(); done();
@ -55,7 +54,6 @@ describe('embark.Blockchain', function () {
genesisBlock: 'foo/bar/genesis.json', genesisBlock: 'foo/bar/genesis.json',
geth_bin: 'geth', geth_bin: 'geth',
datadir: '/foo/datadir/', datadir: '/foo/datadir/',
accountsConfig: {},
mineWhenNeeded: true, mineWhenNeeded: true,
rpcHost: 'someserver', rpcHost: 'someserver',
rpcPort: 12345, rpcPort: 12345,
@ -70,7 +68,7 @@ describe('embark.Blockchain', function () {
whisper: false, whisper: false,
account: {}, account: {},
bootnodes: "", bootnodes: "",
wsApi: [ "eth", "web3", "net", "shh" ], wsApi: ["eth", "web3", "net", "shh"],
wsHost: "localhost", wsHost: "localhost",
wsOrigins: false, wsOrigins: false,
wsPort: 8546, wsPort: 8546,
@ -79,7 +77,7 @@ describe('embark.Blockchain', function () {
fast: false, fast: false,
light: false light: false
}; };
let blockchain = new Blockchain(config, {}, 'geth'); let blockchain = new Blockchain(config, 'geth');
assert.deepEqual(blockchain.config, config); assert.deepEqual(blockchain.config, config);
done(); done();