src/spawn.js
// Start a collator node for a parachain.
Start a collator node for a parachain.
Start a collator node for a parachain .
function startCollator(bin, id, wsPort, port, chain, spec, flags) {
	let args = [
		"--tmp",
		"--ws-port=" + wsPort,
		"--port=" + port,
		"--parachain-id=" + id,
		"--validator",
	];
	if (chain) {
		args.push("--chain=" + chain);
		console.log(`Added --chain=${chain}`);
	}
	let flags_collator = null;
	let flags_parachain = null;
	let split_index = flags ? flags.findIndex((value) => value == "--") : -1;
	if (split_index < 0) {
		flags_parachain = flags;
	} else {
		flags_parachain = flags.slice(0, split_index);
		flags_collator = flags.slice(split_index + 1);
	}
	if (flags_parachain) {
		args = args.concat(flags_parachain);
		console.log(`Added ${flags_parachain} to parachain`);
	}
	args = args.concat([
		"--",
		"--chain=" + spec
	]);
	if (flags_collator) {
		args = args.concat(flags_collator);
		console.log(`Added ${flags_collator} to collator`);
	}
	p[id] = spawn(bin, args);
	let log = fs.createWriteStream(`${id}.log`)
	p[id].stdout.pipe(log)
	p[id].stderr.pipe(log)
}
function startCollator ( bin , id , wsPort , port , chain , spec , flags ) { let args = [ "--tmp" , "--ws-port=" + wsPort , "--port=" + port , "--parachain-id=" + id , "--validator" , ] ; if ( chain ) { args . push ( "--chain=" + chain ) ; console . log ( ` ${ chain } ` ) ; } let flags_collator = null ; let flags_parachain = null ; let split_index = flags ? flags . findIndex ( ( value ) => value == "--" ) : - 1 ; if ( split_index < 0 ) { flags_parachain = flags ; } else { flags_parachain = flags . slice ( 0 , split_index ) ; flags_collator = flags . slice ( split_index + 1 ) ; } if ( flags_parachain ) { args = args . concat ( flags_parachain ) ; console . log ( ` ${ flags_parachain } ` ) ; } args = args . concat ( [ "--" , "--chain=" + spec ] ) ; if ( flags_collator ) { args = args . concat ( flags_collator ) ; console . log ( ` ${ flags_collator } ` ) ; } p [ id ] = spawn ( bin , args ) ; let log = fs . createWriteStream ( ` ${ id } ` ) p [ id ] . stdout . pipe ( log ) p [ id ] . stderr . pipe ( log ) }
Start a collator node for a parachain.
Start a collator node for a parachain .
// TODO: Make DB directory configurable rather than just `tmp` // Add any additional flags to the CLI // Arguments for the relay chain node part of the collator binary. // Add any additional flags to the CLI