From dca0ba6a5d927c3028ec9af247b28d8786b310cf Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 21 Jan 2019 18:40:16 -0800 Subject: [PATCH] Use -X for dynamic fullnodes, to ensure keypair remains constant during iterations --- ci/localnet-sanity.sh | 4 +-- multinode-demo/fullnode.sh | 65 ++++++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh index 30bb06cf1..921ddbb99 100755 --- a/ci/localnet-sanity.sh +++ b/ci/localnet-sanity.sh @@ -68,8 +68,8 @@ nodes=( "multinode-demo/fullnode.sh $maybeNoLeaderRotation --rpc-port 18899" ) -for _ in $(seq 1 $extraNodes); do - nodes+=("multinode-demo/fullnode-x.sh $maybeNoLeaderRotation") +for i in $(seq 1 $extraNodes); do + nodes+=("multinode-demo/fullnode.sh -X dyn$i $maybeNoLeaderRotation") done numNodes=$((2 + extraNodes)) diff --git a/multinode-demo/fullnode.sh b/multinode-demo/fullnode.sh index a4aa7a58a..e26326bec 100755 --- a/multinode-demo/fullnode.sh +++ b/multinode-demo/fullnode.sh @@ -20,14 +20,18 @@ usage() { echo "$*" echo fi - echo "usage: $0 [-x] [--no-leader-rotation] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]" - echo - echo " Start a full node on the specified network" - echo - echo " -x: runs a new, dynamically-configured full node" - echo " --no-leader-rotation: disable leader rotation" - echo " --rpc-port port: custom RPC port for this node" - echo + cat <= 9900 ? 9100 : ++port )) + echo "Testing $port" + if ! nc -w 10 -z 127.0.0.1 $port; then + echo "Selected port $port" + break; + fi + echo "Port $port is in use" + done + $solana_fullnode_config --keypair="$fullnode_id_path" -l -b "$port" > "$fullnode_json_path" + } - echo "Finding a port.." - # Find an available port in the range 9100-9899 - (( port = 9100 + ($$ % 800) )) - while true; do - (( port = port >= 9900 ? 9100 : ++port )) - echo "Testing $port" - if ! nc -w 10 -z 127.0.0.1 $port; then - echo "Selected port $port" - break; - fi - echo "Port $port is in use" - done - - $solana_fullnode_config --keypair="$fullnode_id_path" -l -b "$port" > "$fullnode_json_path" - - ledger_config_dir=$SOLANA_CONFIG_DIR/fullnode-ledger-x$$ + ledger_config_dir=$SOLANA_CONFIG_DIR/fullnode-ledger-x$self_setup_label fi [[ -r $fullnode_id_path ]] || {