Skip to content

Commit ab6a53a

Browse files
author
Leo Chen
authored
Merge pull request #2263 from LeoHChen/archival_mode_and_multi_key_option
[node.sh] disable archival node mode by default
2 parents dfcd408 + 09228d4 commit ab6a53a

File tree

1 file changed

+45
-28
lines changed

1 file changed

+45
-28
lines changed

scripts/node.sh

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ usage: ${progname} [-1ch] [-k KEYFILE]
118118
-V print out the version of the Harmony binary
119119
-B blacklist specify file containing blacklisted accounts as a newline delimited file (default: ./.hmy/blacklist.txt)
120120
-I use statically linked Harmony binary
121+
-M support multi-key mode (default: off)
122+
-A enable archival node mode (default: off)
121123
122124
examples:
123125
@@ -151,7 +153,7 @@ BUCKET=pub.harmony.one
151153
OS=$(uname -s)
152154

153155
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
154-
unset upgrade_rel public_rpc blacklist
156+
unset upgrade_rel public_rpc blacklist multi_key archival
155157
start_clean=false
156158
loop=true
157159
run_as_root=true
@@ -165,11 +167,13 @@ download_harmony_db=false
165167
public_rpc=false
166168
blacklist=./.hmy/blacklist.txt
167169
static=false
170+
multi_key=false
171+
archival=false
168172
${BLSKEYFILE=}
169173

170174
unset OPTIND OPTARG opt
171175
OPTIND=1
172-
while getopts :1chk:sSp:dDmN:tT:i:ba:U:PvVB:I opt
176+
while getopts :1chk:sSp:dDmN:tT:i:ba:U:PvVIMB:A opt
173177
do
174178
case "${opt}" in
175179
'?') usage "unrecognized option -${OPTARG}";;
@@ -183,6 +187,7 @@ do
183187
S) run_as_root=false ;;
184188
p) blspass="${OPTARG}";;
185189
d) download_only=true;;
190+
M) multi_key=true;;
186191
D) do_not_download=true;;
187192
m) metrics=true;;
188193
N) network="${OPTARG}";;
@@ -198,6 +203,7 @@ do
198203
exit 0 ;;
199204
V) LD_LIBRARY_PATH=. ./harmony -version
200205
exit 0 ;;
206+
A) archival=true;;
201207
*) err 70 "unhandled option -${OPTARG}";; # EX_SOFTWARE
202208
esac
203209
done
@@ -430,35 +436,38 @@ if ${run_as_root}; then
430436
check_root
431437
fi
432438

433-
case "${BLSKEYFILE}" in
434-
"")
435-
unset -v f
436-
for f in \
437-
~/*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \
438-
~/????????????????????????????????????????????????????????????????????????????????????????????????.key \
439-
*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \
440-
????????????????????????????????????????????????????????????????????????????????????????????????.key
441-
do
442-
[ -f "${f}" ] || continue
439+
# multi_key mode will use specified keys in .hmy/multikeys directory
440+
if ! ${multi_key}; then
441+
case "${BLSKEYFILE}" in
442+
"")
443+
unset -v f
444+
for f in \
445+
~/*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \
446+
~/????????????????????????????????????????????????????????????????????????????????????????????????.key \
447+
*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \
448+
????????????????????????????????????????????????????????????????????????????????????????????????.key
449+
do
450+
[ -f "${f}" ] || continue
451+
case "${BLSKEYFILE}" in
452+
"")
453+
BLSKEYFILE="${f}"
454+
;;
455+
*)
456+
[ "${f}" -ef "${BLSKEYFILE}" ] || \
457+
err 69 "multiple key files found (${f}, ${BLSKEYFILE}); please use -k to specify"
458+
;;
459+
esac
460+
done
443461
case "${BLSKEYFILE}" in
444-
"")
445-
BLSKEYFILE="${f}"
446-
;;
447-
*)
448-
[ "${f}" -ef "${BLSKEYFILE}" ] || \
449-
err 69 "multiple key files found (${f}, ${BLSKEYFILE}); please use -k to specify"
450-
;;
462+
"") err 69 "could not autodetect BLS key file; please use -k to specify";;
451463
esac
452-
done
453-
case "${BLSKEYFILE}" in
454-
"") err 69 "could not autodetect BLS key file; please use -k to specify";;
464+
msg "autodetected BLS key file: ${BLSKEYFILE}"
465+
;;
466+
*)
467+
msg "using manually specified BLS key file: ${BLSKEYFILE}"
468+
;;
455469
esac
456-
msg "autodetected BLS key file: ${BLSKEYFILE}"
457-
;;
458-
*)
459-
msg "using manually specified BLS key file: ${BLSKEYFILE}"
460-
;;
461-
esac
470+
fi
462471

463472
any_new_binaries() {
464473
local outdir
@@ -646,6 +655,14 @@ do
646655
-dns_zone="${dns_zone}"
647656
-blacklist="${blacklist}"
648657
)
658+
args+=(
659+
-is_archival="${archival}"
660+
)
661+
if ! ${multi_key}; then
662+
args+=(
663+
-blskey_file "${BLSKEYFILE}"
664+
)
665+
fi
649666
if ${public_rpc}; then
650667
args+=(
651668
-public_rpc

0 commit comments

Comments
 (0)