fullnode positional arguments may now be mixed with optional arguments (#4151)
This commit is contained in:
parent
297328ff9a
commit
586fb15c2c
|
@ -9,18 +9,13 @@ source "$here"/common.sh
|
||||||
# shellcheck source=scripts/oom-score-adj.sh
|
# shellcheck source=scripts/oom-score-adj.sh
|
||||||
source "$here"/../scripts/oom-score-adj.sh
|
source "$here"/../scripts/oom-score-adj.sh
|
||||||
|
|
||||||
if [[ -z $CI ]]; then # Skip in CI
|
|
||||||
# shellcheck source=scripts/tune-system.sh
|
|
||||||
source "$here"/../scripts/tune-system.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
fullnode_usage() {
|
fullnode_usage() {
|
||||||
if [[ -n $1 ]]; then
|
if [[ -n $1 ]]; then
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
usage: $0 [--blockstream PATH] [--init-complete-file FILE] [--label LABEL] [--stake LAMPORTS] [--no-voting] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]
|
usage: $0 [--blockstream PATH] [--init-complete-file FILE] [--label LABEL] [--stake LAMPORTS] [--no-voting] [--rpc-port port] [rsync network path to bootstrap leader configuration] [cluster entry point]
|
||||||
|
|
||||||
Start a full node
|
Start a full node
|
||||||
|
|
||||||
|
@ -162,55 +157,61 @@ stake=43 # number of lamports to assign as stake (plus transaction fee to setup
|
||||||
poll_for_new_genesis_block=0
|
poll_for_new_genesis_block=0
|
||||||
label=
|
label=
|
||||||
|
|
||||||
while [[ ${1:0:1} = - ]]; do
|
positional_args=()
|
||||||
if [[ $1 = --label ]]; then
|
while [[ -n $1 ]]; do
|
||||||
label="-$2"
|
if [[ ${1:0:1} = - ]]; then
|
||||||
shift 2
|
if [[ $1 = --label ]]; then
|
||||||
elif [[ $1 = --bootstrap-leader ]]; then
|
label="-$2"
|
||||||
bootstrap_leader=true
|
shift 2
|
||||||
shift
|
elif [[ $1 = --bootstrap-leader ]]; then
|
||||||
elif [[ $1 = --poll-for-new-genesis-block ]]; then
|
bootstrap_leader=true
|
||||||
poll_for_new_genesis_block=1
|
shift
|
||||||
shift
|
elif [[ $1 = --poll-for-new-genesis-block ]]; then
|
||||||
elif [[ $1 = --blockstream ]]; then
|
poll_for_new_genesis_block=1
|
||||||
stake=0
|
shift
|
||||||
extra_fullnode_args+=("$1" "$2")
|
elif [[ $1 = --blockstream ]]; then
|
||||||
shift 2
|
stake=0
|
||||||
elif [[ $1 = --enable-rpc-exit ]]; then
|
extra_fullnode_args+=("$1" "$2")
|
||||||
extra_fullnode_args+=("$1")
|
shift 2
|
||||||
shift
|
elif [[ $1 = --enable-rpc-exit ]]; then
|
||||||
elif [[ $1 = --init-complete-file ]]; then
|
extra_fullnode_args+=("$1")
|
||||||
extra_fullnode_args+=("$1" "$2")
|
shift
|
||||||
shift 2
|
elif [[ $1 = --init-complete-file ]]; then
|
||||||
elif [[ $1 = --stake ]]; then
|
extra_fullnode_args+=("$1" "$2")
|
||||||
stake="$2"
|
shift 2
|
||||||
shift 2
|
elif [[ $1 = --stake ]]; then
|
||||||
elif [[ $1 = --no-voting ]]; then
|
stake="$2"
|
||||||
extra_fullnode_args+=("$1")
|
shift 2
|
||||||
shift
|
elif [[ $1 = --no-voting ]]; then
|
||||||
elif [[ $1 = --no-sigverify ]]; then
|
extra_fullnode_args+=("$1")
|
||||||
extra_fullnode_args+=("$1")
|
shift
|
||||||
shift
|
elif [[ $1 = --no-sigverify ]]; then
|
||||||
elif [[ $1 = --rpc-port ]]; then
|
extra_fullnode_args+=("$1")
|
||||||
extra_fullnode_args+=("$1" "$2")
|
shift
|
||||||
shift 2
|
elif [[ $1 = --rpc-port ]]; then
|
||||||
elif [[ $1 = --dynamic-port-range ]]; then
|
extra_fullnode_args+=("$1" "$2")
|
||||||
extra_fullnode_args+=("$1" "$2")
|
shift 2
|
||||||
shift 2
|
elif [[ $1 = --dynamic-port-range ]]; then
|
||||||
elif [[ $1 = --gossip-port ]]; then
|
extra_fullnode_args+=("$1" "$2")
|
||||||
extra_fullnode_args+=("$1" "$2")
|
shift 2
|
||||||
shift 2
|
elif [[ $1 = --gossip-port ]]; then
|
||||||
elif [[ $1 = -h ]]; then
|
extra_fullnode_args+=("$1" "$2")
|
||||||
fullnode_usage "$@"
|
shift 2
|
||||||
|
elif [[ $1 = -h ]]; then
|
||||||
|
fullnode_usage "$@"
|
||||||
|
else
|
||||||
|
echo "Unknown argument: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Unknown argument: $1"
|
positional_args+=("$1")
|
||||||
exit 1
|
shift
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if $bootstrap_leader; then
|
if $bootstrap_leader; then
|
||||||
if [[ -n $1 ]]; then
|
if [[ ${#positional_args[@]} -ne 0 ]]; then
|
||||||
fullnode_usage "$@"
|
fullnode_usage "Unknown argument: ${positional_args[0]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json ]] ||
|
[[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json ]] ||
|
||||||
|
@ -227,11 +228,12 @@ if $bootstrap_leader; then
|
||||||
default_fullnode_arg --rpc-drone-address 127.0.0.1:9900
|
default_fullnode_arg --rpc-drone-address 127.0.0.1:9900
|
||||||
default_fullnode_arg --gossip-port 8001
|
default_fullnode_arg --gossip-port 8001
|
||||||
else
|
else
|
||||||
if [[ -n $3 ]]; then
|
|
||||||
|
if [[ ${#positional_args[@]} -gt 2 ]]; then
|
||||||
fullnode_usage "$@"
|
fullnode_usage "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r leader leader_address shift < <(find_leader "${@:1:2}")
|
read -r leader leader_address shift < <(find_leader "${positional_args[@]}")
|
||||||
shift "$shift"
|
shift "$shift"
|
||||||
|
|
||||||
fullnode_id_path=$SOLANA_CONFIG_DIR/fullnode-id$label.json
|
fullnode_id_path=$SOLANA_CONFIG_DIR/fullnode-id$label.json
|
||||||
|
@ -258,6 +260,12 @@ ledger: $ledger_config_dir
|
||||||
accounts: $accounts_config_dir
|
accounts: $accounts_config_dir
|
||||||
======================================================================
|
======================================================================
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
if [[ -z $CI ]]; then # Skip in CI
|
||||||
|
# shellcheck source=scripts/tune-system.sh
|
||||||
|
source "$here"/../scripts/tune-system.sh
|
||||||
|
fi
|
||||||
|
|
||||||
default_fullnode_arg --identity "$fullnode_id_path"
|
default_fullnode_arg --identity "$fullnode_id_path"
|
||||||
default_fullnode_arg --voting-keypair "$fullnode_vote_id_path"
|
default_fullnode_arg --voting-keypair "$fullnode_vote_id_path"
|
||||||
default_fullnode_arg --vote-account "$fullnode_vote_id"
|
default_fullnode_arg --vote-account "$fullnode_vote_id"
|
||||||
|
|
|
@ -106,6 +106,7 @@ local|tar)
|
||||||
--stake 0
|
--stake 0
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
args+=("$entrypointIp":~/solana "$entrypointIp:8001")
|
||||||
if $leaderRotation; then
|
if $leaderRotation; then
|
||||||
args+=("--stake" "$stake")
|
args+=("--stake" "$stake")
|
||||||
else
|
else
|
||||||
|
@ -148,7 +149,6 @@ local|tar)
|
||||||
curl --head "$(curl ifconfig.io)"
|
curl --head "$(curl ifconfig.io)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
args+=("$entrypointIp":~/solana "$entrypointIp:8001")
|
|
||||||
./multinode-demo/fullnode.sh "${args[@]}" > fullnode.log 2>&1 &
|
./multinode-demo/fullnode.sh "${args[@]}" > fullnode.log 2>&1 &
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Reference in New Issue