From eb36af87b0f667cbd9a54ea9dfa901357a1041fb Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 18 Feb 2017 08:24:23 -0500 Subject: [PATCH] add support for the bootnodes config --- boilerplate/config/blockchain.json | 2 +- demo/config/blockchain.json | 2 +- lib/blockchain.js | 3 ++- lib/geth_commands.js | 4 ++++ test/blockchain.js | 6 ++++-- test_app/config/blockchain.json | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/boilerplate/config/blockchain.json b/boilerplate/config/blockchain.json index 854426125..94050ca97 100644 --- a/boilerplate/config/blockchain.json +++ b/boilerplate/config/blockchain.json @@ -33,6 +33,6 @@ "rpcPort": 8545, "datadir": "yourdatadir", "networkId": "123", - "nodes": [] + "bootnodes": "" } } diff --git a/demo/config/blockchain.json b/demo/config/blockchain.json index 854426125..94050ca97 100644 --- a/demo/config/blockchain.json +++ b/demo/config/blockchain.json @@ -33,6 +33,6 @@ "rpcPort": 8545, "datadir": "yourdatadir", "networkId": "123", - "nodes": [] + "bootnodes": "" } } diff --git a/lib/blockchain.js b/lib/blockchain.js index 403d2f945..a8e9c1f97 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -21,7 +21,8 @@ var Blockchain = function(blockchainConfig, Client) { mine: this.blockchainConfig.mine || false, account: this.blockchainConfig.account || {}, whisper: (this.blockchainConfig.whisper === undefined) || this.blockchainConfig.whisper, - maxpeers: ((this.blockchainConfig.maxpeers === 0) ? 0 : (this.blockchainConfig.maxpeers || 25)) + maxpeers: ((this.blockchainConfig.maxpeers === 0) ? 0 : (this.blockchainConfig.maxpeers || 25)), + bootnodes: this.blockchainConfig.bootnodes || "" }; this.client = new Client({config: this.config}); diff --git a/lib/geth_commands.js b/lib/geth_commands.js index 575a1c9f0..e3b793198 100644 --- a/lib/geth_commands.js +++ b/lib/geth_commands.js @@ -80,6 +80,10 @@ GethCommands.prototype.mainCommand = function(address) { cmd += "--mine "; } + if (config.bootnodes && config.bootnodes !== "" && config.bootnodes !== []) { + cmd += "--bootnodes " + config.bootnodes; + } + if (config.whisper) { cmd += "--shh "; rpc_api.push('shh'); diff --git a/test/blockchain.js b/test/blockchain.js index 5d17d28f1..7bc91bfa7 100644 --- a/test/blockchain.js +++ b/test/blockchain.js @@ -25,7 +25,8 @@ describe('embark.Blockchain', function() { maxpeers: 25, mine: false, whisper: true, - account: {} + account: {}, + bootnodes: "" }; var blockchain = Blockchain(config, 'geth'); @@ -49,7 +50,8 @@ describe('embark.Blockchain', function() { maxpeers: 25, mine: true, whisper: false, - account: {} + account: {}, + bootnodes: "" }; var blockchain = Blockchain(config, 'geth'); diff --git a/test_app/config/blockchain.json b/test_app/config/blockchain.json index 854426125..94050ca97 100644 --- a/test_app/config/blockchain.json +++ b/test_app/config/blockchain.json @@ -33,6 +33,6 @@ "rpcPort": 8545, "datadir": "yourdatadir", "networkId": "123", - "nodes": [] + "bootnodes": "" } }