Skip to content

Commit 0649f12

Browse files
committed
networkid in initialization of nodes
1 parent 6d40d55 commit 0649f12

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

cli.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ program
2525
.description("Run a Parity development node.")
2626
.action(cmd => {
2727
noAction = false;
28-
run("parity", program.workdir);
28+
run("parity", program.workdir, program.networkId);
2929
});
3030

3131
program
3232
.command("geth")
3333
.description("Run a Geth development node.")
3434
.action(cmd => {
3535
noAction = false;
36-
run("geth", program.workdir);
36+
run("geth", program.workdir, program.networkId);
3737
});
3838

3939
program.parse(process.argv);

main.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ function generateGenesis(client, balances, networkId) {
2727
const genesis = JSON.parse(
2828
JSON.stringify(require(`./genesis.${client}.json`))
2929
);
30-
networkId = networkId || randomId();
3130
if (client === "geth") {
32-
genesis.config.chainId = parseInt(networkId, 10);
31+
genesis.config.chainId = networkId;
3332
genesis.extraData =
3433
"0x" +
3534
"0".repeat(64) +
@@ -71,7 +70,11 @@ function setup(client, workdir) {
7170
function provide(client, workdir, networkId) {
7271
const paths = getPaths(client, workdir);
7372
const keypairs = getKeypairs(KEYS_SOURCE, "password");
74-
const genesis = generateGenesis(client, generateBalances(keypairs), networkId);
73+
const genesis = generateGenesis(
74+
client,
75+
generateBalances(keypairs),
76+
networkId
77+
);
7578
let keysDest =
7679
client === "geth" ? paths.keys : path.join(paths.keys, genesis.name);
7780

@@ -102,6 +105,7 @@ function provide(client, workdir, networkId) {
102105
}
103106

104107
function run(client, workdir, networkId) {
108+
networkId = parseInt(networkId, 10) || randomId();
105109
const paths = getPaths(client, workdir);
106110
setup(client, workdir);
107111
if (!fs.existsSync(paths.genesis)) {
@@ -150,7 +154,9 @@ function run(client, workdir, networkId) {
150154
"--unlock",
151155
keypairs.map(keypair => keypair.address).join(","),
152156
"--password",
153-
paths.password
157+
paths.password,
158+
"--networkid",
159+
networkId
154160
];
155161
} else if (client === "parity") {
156162
args = [
@@ -160,7 +166,7 @@ function run(client, workdir, networkId) {
160166
paths.genesis,
161167
"--keys-path",
162168
paths.keys,
163-
"--gasprice",
169+
"--min-gas-price",
164170
"4000000000",
165171
"--jsonrpc-cors",
166172
"all",
@@ -170,7 +176,9 @@ function run(client, workdir, networkId) {
170176
"--unlock",
171177
keypairs.map(keypair => keypair.address).join(","),
172178
"--password",
173-
paths.password
179+
paths.password,
180+
"--network-id",
181+
networkId
174182
];
175183
} else {
176184
throw `Client "${client}" is not supported`;

0 commit comments

Comments
 (0)