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

Indentation

parent 6a939497
No related branches found
No related tags found
No related merge requests found
...@@ -22,60 +22,63 @@ function modefilter ...@@ -22,60 +22,63 @@ function modefilter
function admin_syncmode function admin_syncmode
{ {
echo "Available synchronization modes:" echo "Available synchronization modes:"
echo " full : verify all blocks and all transactions since genesis (most secure)" echo " full : verify all blocks and all transactions since genesis (most secure)"
echo " fast : verify all blocks but not all transactions (faster than full, but less certain)" echo " fast : verify all blocks but not all transactions (faster than full, but less certain)"
echo " light: Makes this node into a light node which downloads almost" echo " light: Makes this node into a light node which downloads almost"
echo " nothing, but relies on fast and full nodes in the network" echo " nothing, but relies on fast and full nodes in the network"
echo " to answer it's requests. This is the fastest and uses least" echo " to answer it's requests. This is the fastest and uses least"
echo " local resources, but outsources all trust to another node." echo " local resources, but outsources all trust to another node."
echo "Default mode is fast, because for many, it is a healthy compromise" echo "Default mode is fast, because for many, it is a healthy compromise"
echo "between speed and paranoia. You can change the setting, according to" echo "between speed and paranoia. You can change the setting, according to"
echo "your needs." echo "your needs."
mode=$( cat ${BFANODEDIR}/syncmode 2>/dev/null || true ) mode=$( cat ${BFANODEDIR}/syncmode 2>/dev/null || true )
mode=${mode:-${defaultsyncmode}} mode=${mode:-${defaultsyncmode}}
orgmode=$mode orgmode=$mode
modefilter
echo "Your current mode is set to ${mode}"
killed=0
mode=
echo
while [ -z "${mode}" ]
do
read -p "Which mode do you wish? : " mode
modefilter modefilter
done echo "Your current mode is set to ${mode}"
echo $mode > ${BFANODEDIR}/syncmode killed=0
if [ "$orgmode" = "fast" -a "$mode" = "full" ] mode=
then
echo "You increased your paranoia level. The proper thing to do now," echo
echo "would be to delete your version of what you synchronized with" while [ -z "${mode}" ]
echo "fast mode, and revalidate everything in the entire blockchain." do
echo "This probably takes quite a long time and also requires downloading" read -p "Which mode do you wish? : " mode
echo "all blocks from the entire blockchain again." modefilter
yesno n "Do you wish to delete all downloaded blocks and resynchronize?" done
if [ "$REPLY" = "y" ] echo "Remembering your choice."
echo $mode > ${BFANODEDIR}/syncmode
if [ "$orgmode" = "fast" -a "$mode" = "full" ]
then then
if [ -r "${BFANODEDIR}/geth.pid" ] echo "You increased your paranoia level. The proper thing to do now,"
echo "would be to delete your version of what you synchronized with"
echo "fast mode, and revalidate everything in the entire blockchain."
echo "This probably takes quite a long time and also requires downloading"
echo "all blocks from the entire blockchain again."
yesno n "Do you wish to delete all downloaded blocks and resynchronize?"
if [ "$REPLY" = "y" ]
then then
pid=$( cat ${BFANODEDIR}/geth.pid ) if [ -r "${BFANODEDIR}/geth.pid" ]
kill -0 $pid 2>/dev/null && then
echo "Killing running geth." && pid=$( cat ${BFANODEDIR}/geth.pid )
killed=1 kill -0 $pid 2>/dev/null &&
while ! kill $pid 2>/dev/null echo "Killing running geth." &&
do killed=1
sleep 1 while ! kill $pid 2>/dev/null
done do
sleep 1
done
fi
rm -fr ${BFANODEDIR}/geth/chainstate ${BFANODEDIR}/geth/lightchainstate
geth --cache 0 --datadir ${BFANODEDIR} init ${BFAHOME}/src/genesis.json
test $killed -eq 1 &&
echo &&
echo "The startup.sh should restart your geth shortly."
fi fi
rm -fr ${BFANODEDIR}/geth/chainstate ${BFANODEDIR}/geth/lightchainstate else
geth --cache 0 --datadir ${BFANODEDIR} init ${BFAHOME}/src/genesis.json echo "No further action taken."
test $killed -eq 1 &&
echo &&
echo "The startup.sh should restart your geth shortly."
fi fi
fi
} }
function admin_bootnode function admin_bootnode
......
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