Skip to content
Snippets Groups Projects
Commit d3ed18c7 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Parche para --allow-insecure-unlock

parent 15f24023
No related branches found
No related tags found
No related merge requests found
......@@ -78,11 +78,52 @@ function startmonitor
) 9>> $pidfile
}
function geth_capab
{
geth_version=$( geth --help | sed -n '/^VERSION:/{n;s/^ *//;s/-.*$//;p}' )
# default to a dumb version
test -n "${geth_version}" || geth_version=0.0.0
v_major=${geth_version%%.*}
tmp=${geth_version%.*}
v_minor=${tmp#*.}
v_patch=${geth_version##*.}
unset tmp
#
# Determine capabilities
# 0 legacy
# 1 supports --allow-insecure-unlock
cap=0
if [ "${v_major}" -lt 1 ]
then
cap=0
elif [ "${v_major}" -eq 1 ]
then
if [ "${v_minor}" -eq 8 ]
then
if [ "${v_patch}" -gt 28 ]
then
cap=1
fi
elif [ "${v_minor}" -ge 9 ]
then
cap=1
fi
elif [ "${v_major}" -ge 2 ]
then
cap=1
fi
if [ ${cap} -ge 1 ]
then
flexargs="${flexargs} --allow-insecure-unlock"
fi
}
function startgeth
{
# Start the node.
local ERRTEXT="geth section failed"
which geth >/dev/null 2>&1 || return 0
#
(
flock --nonblock --exclusive 9 || (
echo "A geth is already running."
......@@ -93,22 +134,29 @@ function startgeth
then
echo Starting geth
echo Logging everything to ${BFANODEDIR}/log
echo Consider running: tail -n 1000 -F ${BFANODEDIR}/log
echo Consider running: bfalog.sh
fi
loop_counter=0
while :
do
loop_counter=$(( ${loop_counter} + 1 ))
ERRTEXT="geth"
echo
echo '***'
echo "*** loop #${loop_number}"
echo '***'
echo
# (re)configure parameters (you never know if they changed)
flexargs="$( getsyncmode )"
geth_capab
#
xtra=$( extradata )
if [ -n "$xtra" ]
then
flexargs="${flexargs} --extradata $( extradata )"
fi
unset xtra
#
if [ "$netport" != 30303 ]
then
flexargs="${flexargs} --port $netport"
......@@ -121,14 +169,27 @@ function startgeth
then
flexargs="${flexargs} --verbosity ${BFAVERBOSITY:-3}"
fi
# the basic modules
rpcapis="eth,net,web3,clique"
if [ -e "${BFANODEDIR}/opentx" ]
then
# INADDR_ANY
# Oh, and don't put keys in / :-)
flexargs="${flexargs} --rpcapi eth,net,web3,clique --rpcaddr 0.0.0.0 --rpcvhosts localhost,opentx.bfa.ar --keystore /"
# If you want other hostnames, put them in this file (comma separated)
read txhostnames dummy < ${BFANODEDIR}/opentx
if [ "${txhostnames}" = "" ]
then
# but if you don't put any hostnames, these are the defaults
txhostnames="localhost,opentx.bfa.ar"
fi
flexargs="${flexargs} --rpcvhosts ${txhostnames}"
# INADDR_ANY - listen on all addresses
flexargs="${flexargs} --rpcaddr 0.0.0.0"
# Oh, and don't put your keys in / because we use that as a dummy directory
flexargs="${flexargs} --keystore /"
else
flexargs="${flexargs} --rpcapi eth,net,web3,admin,clique,miner,personal"
# expose more modules, if we are a private node (localhost'ed)
rpcapis="${rpcapis},admin,miner,personal"
fi
flexargs="${flexargs} --rpcapi ${rpcapis}"
set -x
geth \
--datadir ${BFANODEDIR} \
......@@ -137,11 +198,11 @@ function startgeth
--gcmode archive \
${flexargs} \
--rpccorsdomain \* \
--allow-insecure-unlock \
--bootnodes "${bootnodes}" &
set +x
echo $! > ${BFANODEDIR}/geth.pid
wait
rv=0
wait -n || rv=$?
sleep 60
done 2>&1 | ${BFAHOME}/bin/log.sh ${BFANODEDIR}/log &
) 9>> ${BFANODEDIR}/start-loop.pid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment