Fix flag to disable leader-rotation (#3243)
This commit is contained in:
@ -10,6 +10,46 @@ source "$here"/common.sh
|
||||
# shellcheck source=scripts/oom-score-adj.sh
|
||||
source "$here"/../scripts/oom-score-adj.sh
|
||||
|
||||
if [[ $1 = -h ]]; then
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
|
||||
extra_fullnode_args=()
|
||||
setup_stakes=true
|
||||
|
||||
while [[ ${1:0:1} = - ]]; do
|
||||
if [[ $1 = --blockstream ]]; then
|
||||
extra_fullnode_args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --enable-rpc-exit ]]; then
|
||||
extra_fullnode_args+=("$1")
|
||||
shift
|
||||
elif [[ $1 = --init-complete-file ]]; then
|
||||
extra_fullnode_args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --only-bootstrap-stake ]]; then
|
||||
setup_stakes=false
|
||||
shift
|
||||
elif [[ $1 = --public-address ]]; then
|
||||
extra_fullnode_args+=("$1")
|
||||
shift
|
||||
elif [[ $1 = --no-signer ]]; then
|
||||
extra_fullnode_args+=("$1")
|
||||
shift
|
||||
elif [[ $1 = --rpc-port ]]; then
|
||||
extra_fullnode_args+=("$1" "$2")
|
||||
shift 2
|
||||
else
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n $3 ]]; then
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
|
||||
|
||||
[[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json ]] || {
|
||||
echo "$SOLANA_CONFIG_DIR/bootstrap-leader-id.json not found, create it by running:"
|
||||
echo
|
||||
@ -27,12 +67,10 @@ tune_system
|
||||
|
||||
$solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger verify
|
||||
|
||||
|
||||
bootstrap_leader_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json
|
||||
bootstrap_leader_staker_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-staker-id.json
|
||||
bootstrap_leader_staker_id=$($solana_wallet --keypair "$bootstrap_leader_staker_id_path" address)
|
||||
|
||||
set -x
|
||||
trap 'kill "$pid" && wait "$pid"' INT TERM ERR
|
||||
$program \
|
||||
--identity "$bootstrap_leader_id_path" \
|
||||
@ -42,11 +80,13 @@ $program \
|
||||
--accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts \
|
||||
--rpc-port 8899 \
|
||||
--rpc-drone-address 127.0.0.1:9900 \
|
||||
"$@" \
|
||||
"${extra_fullnode_args[@]}" \
|
||||
> >($bootstrap_leader_logger) 2>&1 &
|
||||
pid=$!
|
||||
oom_score_adj "$pid" 1000
|
||||
|
||||
setup_fullnode_staking 127.0.0.1 "$bootstrap_leader_id_path" "$bootstrap_leader_staker_id_path"
|
||||
if [[ $setup_stakes = true ]] ; then
|
||||
setup_fullnode_staking 127.0.0.1 "$bootstrap_leader_id_path" "$bootstrap_leader_staker_id_path"
|
||||
fi
|
||||
|
||||
wait "$pid"
|
||||
|
@ -171,6 +171,29 @@ setup_fullnode_staking() {
|
||||
return 0
|
||||
}
|
||||
|
||||
fullnode_usage() {
|
||||
if [[ -n $1 ]]; then
|
||||
echo "$*"
|
||||
echo
|
||||
fi
|
||||
cat <<EOF
|
||||
usage: $0 [-x] [--blockstream PATH] [--init-complete-file FILE] [--only-bootstrap-stake] [--no-signer] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]
|
||||
|
||||
Start a full node on the specified network
|
||||
|
||||
-x - start a new, dynamically-configured full node. Does not apply to the bootstrap leader
|
||||
-X [label] - start or restart a dynamically-configured full node with
|
||||
the specified label. Does not apply to the bootstrap leader
|
||||
--blockstream PATH - open blockstream at this unix domain socket location
|
||||
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
||||
--only-bootstrap-stake - Only stake the bootstrap leader, effectively disabling leader rotation
|
||||
--public-address - advertise public machine address in gossip. By default the local machine address is advertised
|
||||
--no-signer - start node without vote signer
|
||||
--rpc-port port - custom RPC port for this node
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The directory on the bootstrap leader that is rsynced by other full nodes as
|
||||
# they boot (TODO: Eventually this should go away)
|
||||
|
@ -9,37 +9,14 @@ source "$here"/common.sh
|
||||
# shellcheck source=scripts/oom-score-adj.sh
|
||||
source "$here"/../scripts/oom-score-adj.sh
|
||||
|
||||
usage() {
|
||||
if [[ -n $1 ]]; then
|
||||
echo "$*"
|
||||
echo
|
||||
fi
|
||||
cat <<EOF
|
||||
usage: $0 [-x] [--blockstream PATH] [--init-complete-file FILE] [--no-leader-rotation] [--no-signer] [--rpc-port port] [rsync network path to bootstrap leader configuration] [network entry point]
|
||||
|
||||
Start a full node on the specified network
|
||||
|
||||
-x - start a new, dynamically-configured full node
|
||||
-X [label] - start or restart a dynamically-configured full node with
|
||||
the specified label
|
||||
--blockstream PATH - open blockstream at this unix domain socket location
|
||||
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
||||
--no-leader-rotation - disable leader rotation
|
||||
--public-address - advertise public machine address in gossip. By default the local machine address is advertised
|
||||
--no-signer - start node without vote signer
|
||||
--rpc-port port - custom RPC port for this node
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $1 = -h ]]; then
|
||||
usage
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
|
||||
gossip_port=9000
|
||||
extra_fullnode_args=()
|
||||
self_setup=0
|
||||
setup_stakes=true
|
||||
|
||||
while [[ ${1:0:1} = - ]]; do
|
||||
if [[ $1 = -X ]]; then
|
||||
@ -59,8 +36,8 @@ while [[ ${1:0:1} = - ]]; do
|
||||
elif [[ $1 = --init-complete-file ]]; then
|
||||
extra_fullnode_args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --no-leader-rotation ]]; then
|
||||
extra_fullnode_args+=("$1")
|
||||
elif [[ $1 = --only-bootstrap-stake ]]; then
|
||||
setup_stakes=false
|
||||
shift
|
||||
elif [[ $1 = --public-address ]]; then
|
||||
extra_fullnode_args+=("$1")
|
||||
@ -78,7 +55,7 @@ while [[ ${1:0:1} = - ]]; do
|
||||
done
|
||||
|
||||
if [[ -n $3 ]]; then
|
||||
usage
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
|
||||
find_leader() {
|
||||
@ -215,6 +192,8 @@ $program \
|
||||
pid=$!
|
||||
oom_score_adj "$pid" 1000
|
||||
|
||||
setup_fullnode_staking "${leader_address%:*}" "$fullnode_id_path" "$fullnode_staker_id_path"
|
||||
if [[ $setup_stakes = true ]]; then
|
||||
setup_fullnode_staking "${leader_address%:*}" "$fullnode_id_path" "$fullnode_staker_id_path"
|
||||
fi
|
||||
|
||||
wait "$pid"
|
||||
|
Reference in New Issue
Block a user