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

Cambios en start.sh

parent b8d741f4
No related branches found
No related tags found
No related merge requests found
......@@ -99,21 +99,34 @@ function geth_rpc
echo "$json" | jq .result
}
function create_account
{
geth --cache 0 --datadir ${BFANODEDIR} --password /dev/null account new
}
function extradata
{
# something uniqueish
## find default interface
local def_if=$(
( ip -4 route show ; ip -6 route show ) |
expand |
sed -ne '/^default /{s/ */ /g;s/^.* dev //;s/ .*//;p;q}'
)
local mymac=$(
ip link show ${def_if} |
sed -ne '/link\|ether/{s/^.*link.ether //;s/ .*//;s/://g;p;q}'
local acct=$(
ls -1d "${BFANODEDIR}"/keystore/*--* 2>/dev/null |
head -1 |
sed 's/.*--//'
)
#
echo -n "${BFAACCOUNT:0:19}.${mymac:0:12}"
if [ -n "$acct" ]
then
# something uniqueish
## find default interface
local def_if=$(
( ip -4 route show ; ip -6 route show ) |
expand |
sed -ne '/^default /{s/ */ /g;s/^.* dev //;s/ .*//;p;q}'
)
local mymac=$(
ip link show ${def_if} |
sed -ne '/link\|ether/{s/^.*link.ether //;s/ .*//;s/://g;p;q}'
)
#
echo -n "${acct:0:19}.${mymac:0:12}"
fi
}
function prereq
......@@ -191,6 +204,10 @@ then
netport=$( cat ${BFANODEDIR}/netport )
test $? = 0
fi
if [ "$netport" != "30303" ]
then
netportarg="--port ${netport}"
fi
#
# rpcport
rpcport=8545
......@@ -199,18 +216,7 @@ then
rpcport=$( cat ${BFANODEDIR}/rpcport )
test $? = 0
fi
#
# BFAACCOUNT
if [ -z "$BFAACCOUNT" ]
if [ "$rpcport" != "8545" ]
then
if ! ls -1d ${BFANODEDIR}/keystore/*--* >/dev/null 2>&1
then
echo "No accounts found. Creating a new one (they are free)."
geth --cache 0 --datadir ${BFANODEDIR} --password /dev/null account new
fi
BFAACCOUNT=$(
ls -1d "${BFANODEDIR}"/keystore/*--* 2>/dev/null |
head -1 |
sed 's/.*--//'
)
rpcportarg="--rpcport ${rpcport}"
fi
......@@ -26,10 +26,6 @@ function getsyncmode
echo "--syncmode ${syncmode}"
}
test -n "${BFAACCOUNT}" ||
fatal "No account defined."
function startbootnode
{
local ERRTEXT="bootnode section failed"
......@@ -101,18 +97,26 @@ function startgeth
echo
# (re)configure parameters (you never know if they changed)
flexargs="$( getsyncmode ) --extradata $( extradata )"
if [ "$netport" != 30303 ]
then
flexargs="${flexargs} --net $netport"
fi
if [ "$rpcport" != 30303 ]
then
flexargs="${flexargs} --rpcport $rpcport"
fi
if [ -n "$BFAVERBOSITY" -a "$BFAVERBOSITY" != 3 ]
then
flexargs="${flexargs} --verbosity ${BFAVERBOSITY:-3}"
fi
set -x
geth \
--datadir ${BFANODEDIR} \
--networkid ${BFANETWORKID} \
--rpc \
--rpcport $rpcport \
--rpcapi "eth,net,web3,admin,clique,miner,personal" \
--port $netport \
--nousb \
--gcmode archive \
--cache 512 \
--verbosity ${BFAVERBOSITY:-3} \
${flexargs} \
--bootnodes "${bootnodes}" &
set +x
......
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