Skip to content

Commit 5c283b5

Browse files
committed
support maxpeers option
1 parent 6920ae9 commit 5c283b5

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

boilerplate/config/blockchain.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"datadir": ".embark/development/datadir",
66
"mineWhenNeeded": true,
77
"nodiscover": true,
8+
"maxpeers": 0,
89
"rpcHost": "localhost",
910
"rpcPort": 8545,
1011
"rpcCorsDomain": "http://localhost:8000",

demo/config/blockchain.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"datadir": ".embark/development/datadir",
66
"mineWhenNeeded": true,
77
"nodiscover": true,
8+
"maxpeers": 0,
89
"rpcHost": "localhost",
910
"rpcPort": 8545,
1011
"rpcCorsDomain": "http://localhost:8000",

lib/blockchain.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ var Blockchain = function(blockchainConfig, Client) {
2020
nodiscover: this.blockchainConfig.nodiscover || false,
2121
mine: this.blockchainConfig.mine || false,
2222
account: this.blockchainConfig.account || {},
23-
whisper: (this.blockchainConfig.whisper === undefined) || this.blockchainConfig.whisper
23+
whisper: (this.blockchainConfig.whisper === undefined) || this.blockchainConfig.whisper,
24+
maxpeers: this.blockchainConfig.maxpeers || 25
2425
};
2526

2627
this.client = new Client({config: this.config});

lib/geth_commands.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ GethCommands.prototype.mainCommand = function(address) {
7474
cmd += "--nodiscover ";
7575
}
7676

77+
cmd += "--maxpeers " + config.maxpeers + " ";
78+
7779
if (config.mineWhenNeeded || config.mine) {
7880
cmd += "--mine ";
7981
}

test/blockchain.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe('embark.Blockchain', function() {
2222
networkId: 12301,
2323
port: 30303,
2424
nodiscover: false,
25+
maxpeers: 25,
2526
mine: false,
2627
whisper: true,
2728
account: {}
@@ -45,6 +46,7 @@ describe('embark.Blockchain', function() {
4546
networkId: 1,
4647
port: 123456,
4748
nodiscover: true,
49+
maxpeers: 25,
4850
mine: true,
4951
whisper: false,
5052
account: {}

0 commit comments

Comments
 (0)