From 87ff194ce42082c12f5027c0544039c1a0167a73 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 21 Feb 2017 21:04:15 -0500 Subject: [PATCH] extract method for determing rpc options --- lib/cmds/blockchain/geth_commands.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/cmds/blockchain/geth_commands.js b/lib/cmds/blockchain/geth_commands.js index 02e2ab76..4f2964c7 100644 --- a/lib/cmds/blockchain/geth_commands.js +++ b/lib/cmds/blockchain/geth_commands.js @@ -63,12 +63,8 @@ GethCommands.prototype.listAccountsCommand = function() { return this.geth_bin + " " + this.commonOptions() + "account list "; }; -GethCommands.prototype.mainCommand = function(address) { - var config = this.config; - var cmd = this.geth_bin + " "; - var rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']); - - cmd += this.commonOptions(); +GethCommands.prototype.determineRpcOptions = function(config) { + var cmd = ""; cmd += "--port " + config.port + " "; cmd += "--rpc "; @@ -87,6 +83,18 @@ GethCommands.prototype.mainCommand = function(address) { console.log('=================================='); } + return cmd; +}; + +GethCommands.prototype.mainCommand = function(address) { + var config = this.config; + var cmd = this.geth_bin + " "; + var rpc_api = (this.config.rpcApi || ['eth', 'web3', 'net']); + + cmd += this.commonOptions(); + + cmd += this.determineRpcOptions(this.config); + if (config.nodiscover) { cmd += "--nodiscover "; }