fixed problem with double this.client in blockchain.js
This commit is contained in:
parent
fbe3f302b2
commit
7599f43a3b
|
@ -18,7 +18,7 @@ class Blockchain {
|
|||
constructor(options) {
|
||||
this.blockchainConfig = options.blockchainConfig;
|
||||
this.env = options.env || 'development';
|
||||
this.client = BlockchainClient(this.blockchainConfig, 'geth', this.env);
|
||||
this.client = options.client;
|
||||
|
||||
this.config = {
|
||||
geth_bin: this.blockchainConfig.geth_bin || 'geth',
|
||||
|
@ -47,18 +47,18 @@ class Blockchain {
|
|||
return shelljs.exec(cmd);
|
||||
}
|
||||
|
||||
run () {
|
||||
var self = this;
|
||||
console.log("===============================================================================".magenta);
|
||||
console.log("===============================================================================".magenta);
|
||||
console.log(("Embark Blockchain Using: " + this.client.name.underline).magenta);
|
||||
console.log("===============================================================================".magenta);
|
||||
console.log("===============================================================================".magenta);
|
||||
let address = this.initChainAndGetAddress();
|
||||
this.client.mainCommand(address, function(cmd) {
|
||||
shelljs.exec(cmd, {async : true});
|
||||
});
|
||||
}
|
||||
run () {
|
||||
var self = this;
|
||||
console.log("===============================================================================".magenta);
|
||||
console.log("===============================================================================".magenta);
|
||||
console.log(("Embark Blockchain Using: " + this.client.name.underline).magenta);
|
||||
console.log("===============================================================================".magenta);
|
||||
console.log("===============================================================================".magenta);
|
||||
let address = this.initChainAndGetAddress();
|
||||
this.client.mainCommand(address, function(cmd) {
|
||||
shelljs.exec(cmd, {async : true});
|
||||
});
|
||||
}
|
||||
|
||||
initChainAndGetAddress() {
|
||||
let address = null, result;
|
||||
|
|
|
@ -1,47 +1,45 @@
|
|||
/*globals describe, it*/
|
||||
const Blockchain = require('../lib/cmds/blockchain/blockchain');
|
||||
// let BlockchainClient = require('../lib/cmds/blockchain/blockchain_client');
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
describe('embark.Blockchain', function() {
|
||||
describe('embark.Blockchain', function () {
|
||||
//let Client = function() {};
|
||||
//Client.prototype.name = "ClientName";
|
||||
|
||||
describe('#initializer', function() {
|
||||
describe('#initializer', function () {
|
||||
//let client = new Client();
|
||||
|
||||
describe('with empty config', function() {
|
||||
it('should have a default config', function() {
|
||||
describe('with empty config', function () {
|
||||
it('should have a default config', function () {
|
||||
let config = {
|
||||
blockchainConfig: {
|
||||
networkType: 'custom',
|
||||
genesisBlock: false,
|
||||
geth_bin: 'geth',
|
||||
datadir: false,
|
||||
mineWhenNeeded: false,
|
||||
rpcHost: 'localhost',
|
||||
rpcPort: 8545,
|
||||
rpcApi: ['eth', 'web3', 'net'],
|
||||
rpcCorsDomain: false,
|
||||
networkId: 12301,
|
||||
port: 30303,
|
||||
nodiscover: false,
|
||||
maxpeers: 25,
|
||||
mine: false,
|
||||
vmdebug: false,
|
||||
whisper: true,
|
||||
account: {},
|
||||
bootnodes: "",
|
||||
}
|
||||
}
|
||||
networkType: 'custom',
|
||||
genesisBlock: false,
|
||||
geth_bin: 'geth',
|
||||
datadir: false,
|
||||
mineWhenNeeded: false,
|
||||
rpcHost: 'localhost',
|
||||
rpcPort: 8545,
|
||||
rpcApi: ['eth', 'web3', 'net'],
|
||||
rpcCorsDomain: false,
|
||||
networkId: 12301,
|
||||
port: 30303,
|
||||
nodiscover: false,
|
||||
maxpeers: 25,
|
||||
mine: false,
|
||||
vmdebug: false,
|
||||
whisper: true,
|
||||
account: {},
|
||||
bootnodes: ""
|
||||
};
|
||||
let blockchain = new Blockchain(config, 'geth');
|
||||
|
||||
assert.deepEqual(blockchain.config, config);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with config', function() {
|
||||
it('should take config params', function() {
|
||||
describe('with config', function () {
|
||||
it('should take config params', function () {
|
||||
let config = {
|
||||
networkType: 'livenet',
|
||||
genesisBlock: 'foo/bar/genesis.json',
|
||||
|
|
Loading…
Reference in New Issue