Skip to content

Commit ab54604

Browse files
committed
update
1 parent 83e70ba commit ab54604

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

container-manager/src/gen/gen_xdpos.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ for (let i = 1; i <= config.num_machines; i++) {
5353
doc, (ip_record = gen_compose.injectNetworkConfig(doc));
5454
subnetconf = [];
5555
for (let i = 1; i <= config.num_subnet; i++) {
56-
subnetconf.push(gen_env.genSubnetConfig(i, keys, ip_record));
56+
subnetconf.push(genXdposNodeConfig(i, keys, ip_record));
5757
}
5858

5959
const compose_content = yaml.dump(doc, {});
@@ -286,3 +286,31 @@ function genGenesisInputFileXdpos(keys) {
286286

287287
return out;
288288
}
289+
290+
function genXdposNodeConfig(subnet_id, key, ip_record) {
291+
const key_name = `key${subnet_id}`;
292+
let private_key = key[key_name]["PrivateKey"];
293+
private_key = private_key.slice(2, private_key.length); // remove 0x for subnet conf
294+
const port = 20303 + subnet_id - 1;
295+
const rpcport = 8545 + subnet_id - 1;
296+
const wsport = 9555 + subnet_id - 1;
297+
const bootnode_ip =
298+
config.num_machines === 1 ? ip_record["bootnode"] : config.ip_1;
299+
const stats_ip = config.num_machines === 1 ? ip_record["stats"] : config.ip_1;
300+
const config_env = `
301+
INSTANCE_NAME=Masternode${subnet_id}
302+
PRIVATE_KEY=${private_key}
303+
BOOTNODES=enode://cc566d1033f21c7eb0eb9f403bb651f3949b5f63b40683917\
304+
765c343f9c0c596e9cd021e2e8416908cbc3ab7d6f6671a83c85f7b121c1872f8be\
305+
50a591723a5d@${bootnode_ip}:20301
306+
NETWORK=local
307+
NETWORK_ID=${config.network_id}
308+
RPC_API=db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS
309+
PORT=${port}
310+
RPC_PORT=${rpcport}
311+
WS_PORT=${wsport}
312+
LOG_LEVEL=2
313+
`;
314+
315+
return config_env;
316+
}

0 commit comments

Comments
 (0)