Use -X for dynamic fullnodes, to ensure keypair remains constant during iterations
This commit is contained in:
@ -68,8 +68,8 @@ nodes=(
|
|||||||
"multinode-demo/fullnode.sh $maybeNoLeaderRotation --rpc-port 18899"
|
"multinode-demo/fullnode.sh $maybeNoLeaderRotation --rpc-port 18899"
|
||||||
)
|
)
|
||||||
|
|
||||||
for _ in $(seq 1 $extraNodes); do
|
for i in $(seq 1 $extraNodes); do
|
||||||
nodes+=("multinode-demo/fullnode-x.sh $maybeNoLeaderRotation")
|
nodes+=("multinode-demo/fullnode.sh -X dyn$i $maybeNoLeaderRotation")
|
||||||
done
|
done
|
||||||
numNodes=$((2 + extraNodes))
|
numNodes=$((2 + extraNodes))
|
||||||
|
|
||||||
|
@ -20,14 +20,18 @@ usage() {
|
|||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
echo "usage: $0 [-x] [--no-leader-rotation] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]"
|
cat <<EOF
|
||||||
echo
|
usage: $0 [-x] [--no-leader-rotation] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]
|
||||||
echo " Start a full node on the specified network"
|
|
||||||
echo
|
Start a full node on the specified network
|
||||||
echo " -x: runs a new, dynamically-configured full node"
|
|
||||||
echo " --no-leader-rotation: disable leader rotation"
|
-x - start a new, dynamically-configured full node
|
||||||
echo " --rpc-port port: custom RPC port for this node"
|
-X [label] - start or restart a dynamically-configured full node with
|
||||||
echo
|
the specified label
|
||||||
|
--no-leader-rotation - disable leader rotation
|
||||||
|
--rpc-port port - custom RPC port for this node
|
||||||
|
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,8 +39,13 @@ if [[ $1 = -h ]]; then
|
|||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 = -x ]]; then
|
if [[ $1 = -X ]]; then
|
||||||
self_setup=1
|
self_setup=1
|
||||||
|
self_setup_label=$2
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = -x ]]; then
|
||||||
|
self_setup=1
|
||||||
|
self_setup_label=$$
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
self_setup=0
|
self_setup=0
|
||||||
@ -134,12 +143,12 @@ if ((!self_setup)); then
|
|||||||
ledger_config_dir=$SOLANA_CONFIG_DIR/fullnode-ledger
|
ledger_config_dir=$SOLANA_CONFIG_DIR/fullnode-ledger
|
||||||
else
|
else
|
||||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||||
fullnode_id_path=$SOLANA_CONFIG_DIR/fullnode-id-x$$.json
|
fullnode_id_path=$SOLANA_CONFIG_DIR/fullnode-id-x$self_setup_label.json
|
||||||
$solana_keygen -o "$fullnode_id_path"
|
[[ -f "$fullnode_id_path" ]] || $solana_keygen -o "$fullnode_id_path"
|
||||||
|
|
||||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||||
fullnode_json_path=$SOLANA_CONFIG_DIR/fullnode-x$$.json
|
fullnode_json_path=$SOLANA_CONFIG_DIR/fullnode-x$self_setup_label.json
|
||||||
|
[[ -f "$fullnode_json_path" ]] || {
|
||||||
echo "Finding a port.."
|
echo "Finding a port.."
|
||||||
# Find an available port in the range 9100-9899
|
# Find an available port in the range 9100-9899
|
||||||
(( port = 9100 + ($$ % 800) ))
|
(( port = 9100 + ($$ % 800) ))
|
||||||
@ -152,10 +161,10 @@ else
|
|||||||
fi
|
fi
|
||||||
echo "Port $port is in use"
|
echo "Port $port is in use"
|
||||||
done
|
done
|
||||||
|
|
||||||
$solana_fullnode_config --keypair="$fullnode_id_path" -l -b "$port" > "$fullnode_json_path"
|
$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
|
fi
|
||||||
|
|
||||||
[[ -r $fullnode_id_path ]] || {
|
[[ -r $fullnode_id_path ]] || {
|
||||||
|
Reference in New Issue
Block a user