make maxpeers configurable

This commit is contained in:
Iuri Matias 2015-07-29 21:40:49 -04:00
parent 29d25e3621
commit 6ff72432d6
5 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@ development:
genesis_block: config/genesis.json
datadir: /tmp/embark
mine_when_needed: true
max_peers: 0
gas_limit: 500000
gas_price: 10000000000000
console: false
@ -18,6 +19,7 @@ staging:
rpc_whitelist: "*"
datadir: default
network_id: 0
max_peers: 4
console: true
account:
init: false
@ -28,6 +30,7 @@ production:
rpc_whitelist: "*"
datadir: default
network_id: 1
max_peers: 4
console: true
account:
init: false

View File

@ -31,7 +31,7 @@ Blockchain.prototype.generate_basic_command = function() {
}
//TODO: this should be configurable
cmd += "--maxpeers 0 ";
cmd += "--maxpeers " + config.maxPeers + " ";
if (config.account.password !== void 0) {
cmd += "--password " + config.account.password + " ";

View File

@ -41,6 +41,7 @@ BlockchainConfig.prototype.config = function(env) {
genesisBlock: config.genesis_block,
datadir: config.datadir,
networkId: networkId,
maxPeers: 4,
port: config.port || "30303",
console_toggle: config.console || false,
mine_when_needed: config.mine_when_needed || false,

View File

@ -10,7 +10,7 @@ describe('embark.blockchain', function() {
var blockchain = new Blockchain(blockchainConfig);
it('should return correct cmd', function() {
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --maxpeers 0 --password config/password ");
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --maxpeers 4 --password config/password ");
});
});

View File

@ -67,6 +67,7 @@ describe('embark.config.blockchain', function() {
genesisBlock: 'config/genesis.json',
datadir: '/tmp/embark',
networkId: 0,
maxPeers: 4,
port: "30303",
console_toggle: false,
mine_when_needed: true,
@ -108,6 +109,7 @@ describe('embark.config.blockchain', function() {
genesisBlock: undefined,
datadir: '/tmp/embark',
networkId: 0,
maxPeers: 4,
port: "30303",
console_toggle: false,
mine_when_needed: true,