diff --git a/scripts/node.sh b/scripts/node.sh index 1777886bd..ba0331b3d 100755 --- a/scripts/node.sh +++ b/scripts/node.sh @@ -121,6 +121,7 @@ options: -V print out the version of the Harmony binary -z run in staking mode -y run in legacy, foundational-node mode (default) + -M support multi-key mode (default: off) examples: @@ -157,7 +158,7 @@ BUCKET=pub.harmony.one OS=$(uname -s) unset start_clean loop run_as_root blspass do_not_download download_only metrics network node_type shard_id download_harmony_db db_file_to_dl -unset upgrade_rel public_rpc staking_mode pub_port +unset upgrade_rel public_rpc staking_mode pub_port multi_key start_clean=false loop=true run_as_root=true @@ -170,11 +171,12 @@ shard_id=1 download_harmony_db=false public_rpc=false staking_mode=false +multi_key=false ${BLSKEYFILE=} unset OPTIND OPTARG opt OPTIND=1 -while getopts :1chk:sSp:dDmN:tT:i:ba:U:PvVyzn: opt +while getopts :1chk:sSp:dDmN:tT:i:ba:U:PvVyzn:M opt do case "${opt}" in '?') usage "unrecognized option -${OPTARG}";; @@ -189,6 +191,7 @@ do p) blspass="${OPTARG}";; d) download_only=true;; D) do_not_download=true;; + M) multi_key=true;; m) metrics=true;; N) network="${OPTARG}";; n) pub_port="${OPTARG}";; @@ -438,35 +441,38 @@ if ${run_as_root}; then check_root fi -case "${BLSKEYFILE}" in -"") - unset -v f - for f in \ - ~/*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \ - ~/????????????????????????????????????????????????????????????????????????????????????????????????.key \ - *--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \ - ????????????????????????????????????????????????????????????????????????????????????????????????.key - do - [ -f "${f}" ] || continue +# multi_key mode will use specified keys in .hmy/multikeys directory +if ! ${multi_key}; then + case "${BLSKEYFILE}" in + "") + unset -v f + for f in \ + ~/*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \ + ~/????????????????????????????????????????????????????????????????????????????????????????????????.key \ + *--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \ + ????????????????????????????????????????????????????????????????????????????????????????????????.key + do + [ -f "${f}" ] || continue + case "${BLSKEYFILE}" in + "") + BLSKEYFILE="${f}" + ;; + *) + [ "${f}" -ef "${BLSKEYFILE}" ] || \ + err 69 "multiple key files found (${f}, ${BLSKEYFILE}); please use -k to specify" + ;; + esac + done case "${BLSKEYFILE}" in - "") - BLSKEYFILE="${f}" - ;; - *) - [ "${f}" -ef "${BLSKEYFILE}" ] || \ - err 69 "multiple key files found (${f}, ${BLSKEYFILE}); please use -k to specify" - ;; + "") err 69 "could not autodetect BLS key file; please use -k to specify";; esac - done - case "${BLSKEYFILE}" in - "") err 69 "could not autodetect BLS key file; please use -k to specify";; + msg "autodetected BLS key file: ${BLSKEYFILE}" + ;; + *) + msg "using manually specified BLS key file: ${BLSKEYFILE}" + ;; esac - msg "autodetected BLS key file: ${BLSKEYFILE}" - ;; -*) - msg "using manually specified BLS key file: ${BLSKEYFILE}" - ;; -esac +fi any_new_binaries() { local outdir @@ -649,10 +655,14 @@ do -ip "${PUB_IP}" -port "${NODE_PORT}" -is_genesis - -blskey_file "${BLSKEYFILE}" -network_type="${network_type}" -dns_zone="${dns_zone}" ) + if ! ${multi_key}; then + args+=( + -blskey_file "${BLSKEYFILE}" + ) + fi if ${public_rpc}; then args+=( -public_rpc