|
|
@ -86,11 +86,12 @@ fi |
|
|
|
|
|
|
|
|
|
|
|
print_usage() { |
|
|
|
print_usage() { |
|
|
|
cat <<- ENDEND |
|
|
|
cat <<- ENDEND |
|
|
|
usage: ${progname} [-1ch] account_address |
|
|
|
usage: ${progname} [-1ch] [-k KEYFILE] |
|
|
|
-c back up database/logs and start clean |
|
|
|
-c back up database/logs and start clean |
|
|
|
(use only when directed by Harmony) |
|
|
|
(use only when directed by Harmony) |
|
|
|
-1 do not loop; run once and exit |
|
|
|
-1 do not loop; run once and exit |
|
|
|
-h print this help and exit |
|
|
|
-h print this help and exit |
|
|
|
|
|
|
|
-k KEYFILE use the given BLS key file (default: autodetect) |
|
|
|
ENDEND |
|
|
|
ENDEND |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -103,10 +104,11 @@ usage() { |
|
|
|
unset start_clean loop |
|
|
|
unset start_clean loop |
|
|
|
start_clean=false |
|
|
|
start_clean=false |
|
|
|
loop=true |
|
|
|
loop=true |
|
|
|
|
|
|
|
${BLSKEYFILE=} |
|
|
|
|
|
|
|
|
|
|
|
unset OPTIND OPTARG opt |
|
|
|
unset OPTIND OPTARG opt |
|
|
|
OPTIND=1 |
|
|
|
OPTIND=1 |
|
|
|
while getopts :1ch opt |
|
|
|
while getopts :1chk: opt |
|
|
|
do |
|
|
|
do |
|
|
|
case "${opt}" in |
|
|
|
case "${opt}" in |
|
|
|
'?') usage "unrecognized option -${OPTARG}";; |
|
|
|
'?') usage "unrecognized option -${OPTARG}";; |
|
|
@ -114,25 +116,44 @@ do |
|
|
|
c) start_clean=true;; |
|
|
|
c) start_clean=true;; |
|
|
|
1) loop=false;; |
|
|
|
1) loop=false;; |
|
|
|
h) print_usage; exit 0;; |
|
|
|
h) print_usage; exit 0;; |
|
|
|
|
|
|
|
k) BLSKEYFILE="${OPTARG}";; |
|
|
|
*) err 70 "unhandled option -${OPTARG}";; # EX_SOFTWARE |
|
|
|
*) err 70 "unhandled option -${OPTARG}";; # EX_SOFTWARE |
|
|
|
esac |
|
|
|
esac |
|
|
|
done |
|
|
|
done |
|
|
|
shift $((${OPTIND} - 1)) |
|
|
|
shift $((${OPTIND} - 1)) |
|
|
|
|
|
|
|
|
|
|
|
case $# in |
|
|
|
case $# in |
|
|
|
0) |
|
|
|
[1-9]*) |
|
|
|
usage "Please provide account address." \ |
|
|
|
usage "extra arguments at the end ($*)" |
|
|
|
"For foundational nodes, please follow the instructions in Discord #foundational-nodes channel" \ |
|
|
|
|
|
|
|
"to generate and register your account address with <genesis at harmony dot one>." |
|
|
|
|
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
IDX="${1}" |
|
|
|
case "${BLSKEYFILE}" in |
|
|
|
shift 1 |
|
|
|
"") |
|
|
|
|
|
|
|
unset -v f |
|
|
|
case $# in |
|
|
|
for f in \ |
|
|
|
[1-9]*) |
|
|
|
~/*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \ |
|
|
|
usage "extra arguments at the end ($*)" |
|
|
|
~/????????????????????????????????????????????????????????????????????????????????????????????????.key \ |
|
|
|
|
|
|
|
*--????-??-??T??-??-??.*Z--bls_???????????????????????????????????????????????????????????????????????????????????????????????? \ |
|
|
|
|
|
|
|
????????????????????????????????????????????????????????????????????????????????????????????????.key |
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
[ -f "${f}" ] || continue |
|
|
|
|
|
|
|
case "${BLSKEYFILE}" in |
|
|
|
|
|
|
|
"") |
|
|
|
|
|
|
|
BLSKEYFILE="${f}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
err 69 "multiple key files found (${f}, ${BLSKEYFILE}); please use -k to specify" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
case "${BLSKEYFILE}" in |
|
|
|
|
|
|
|
"") err 69 "could not autodetect BLS key file; please use -k to specify";; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
msg "autodetected BLS key file: ${BLSKEYFILE}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
msg "using manually specified BLS key file: ${BLSKEYFILE}" |
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
@ -298,7 +319,7 @@ kill_node() { |
|
|
|
check_update_pid=$! |
|
|
|
check_update_pid=$! |
|
|
|
|
|
|
|
|
|
|
|
unset -v passphrase |
|
|
|
unset -v passphrase |
|
|
|
read -rsp "Enter passphrase for account ${IDX}: " passphrase |
|
|
|
read -rsp "Enter passphrase for the BLS key file ${BLSKEYFILE}: " passphrase |
|
|
|
echo |
|
|
|
echo |
|
|
|
|
|
|
|
|
|
|
|
while : |
|
|
|
while : |
|
|
@ -306,9 +327,9 @@ do |
|
|
|
msg "############### Running Harmony Process ###############" |
|
|
|
msg "############### Running Harmony Process ###############" |
|
|
|
if [ "$OS" == "Linux" ]; then |
|
|
|
if [ "$OS" == "Linux" ]; then |
|
|
|
# Run Harmony Node |
|
|
|
# Run Harmony Node |
|
|
|
echo -n "${passphrase}" | LD_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -is_archival -accounts $IDX -pass stdin |
|
|
|
echo -n "${passphrase}" | LD_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -blskey_file "${BLSKEYFILE}" -blspass stdin |
|
|
|
else |
|
|
|
else |
|
|
|
echo -n "${passphrase}" | DYLD_FALLBACK_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -is_archival -accounts $IDX -pass stdin |
|
|
|
echo -n "${passphrase}" | DYLD_FALLBACK_LIBRARY_PATH=$(pwd) ./harmony -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -is_genesis -blskey_file "${BLSKEYFILE}" -blspass stdin |
|
|
|
fi || msg "node process finished with status $?" |
|
|
|
fi || msg "node process finished with status $?" |
|
|
|
${loop} || break |
|
|
|
${loop} || break |
|
|
|
msg "restarting in 10s..." |
|
|
|
msg "restarting in 10s..." |
|
|
|