Skip to content

Commit 6ff7243

Browse files
committed
make maxpeers configurable
1 parent 29d25e3 commit 6ff7243

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

boilerplate/config/blockchain.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ development:
66
genesis_block: config/genesis.json
77
datadir: /tmp/embark
88
mine_when_needed: true
9+
max_peers: 0
910
gas_limit: 500000
1011
gas_price: 10000000000000
1112
console: false
@@ -18,6 +19,7 @@ staging:
1819
rpc_whitelist: "*"
1920
datadir: default
2021
network_id: 0
22+
max_peers: 4
2123
console: true
2224
account:
2325
init: false
@@ -28,6 +30,7 @@ production:
2830
rpc_whitelist: "*"
2931
datadir: default
3032
network_id: 1
33+
max_peers: 4
3134
console: true
3235
account:
3336
init: false

lib/blockchain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Blockchain.prototype.generate_basic_command = function() {
3131
}
3232

3333
//TODO: this should be configurable
34-
cmd += "--maxpeers 0 ";
34+
cmd += "--maxpeers " + config.maxPeers + " ";
3535

3636
if (config.account.password !== void 0) {
3737
cmd += "--password " + config.account.password + " ";

lib/config/blockchain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ BlockchainConfig.prototype.config = function(env) {
4141
genesisBlock: config.genesis_block,
4242
datadir: config.datadir,
4343
networkId: networkId,
44+
maxPeers: 4,
4445
port: config.port || "30303",
4546
console_toggle: config.console || false,
4647
mine_when_needed: config.mine_when_needed || false,

test/blockchain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('embark.blockchain', function() {
1010
var blockchain = new Blockchain(blockchainConfig);
1111

1212
it('should return correct cmd', function() {
13-
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 ");
13+
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 ");
1414
});
1515
});
1616

test/config.blockchain.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ describe('embark.config.blockchain', function() {
6767
genesisBlock: 'config/genesis.json',
6868
datadir: '/tmp/embark',
6969
networkId: 0,
70+
maxPeers: 4,
7071
port: "30303",
7172
console_toggle: false,
7273
mine_when_needed: true,
@@ -108,6 +109,7 @@ describe('embark.config.blockchain', function() {
108109
genesisBlock: undefined,
109110
datadir: '/tmp/embark',
110111
networkId: 0,
112+
maxPeers: 4,
111113
port: "30303",
112114
console_toggle: false,
113115
mine_when_needed: true,

0 commit comments

Comments
 (0)