2022-10-14 03:18:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ "true" == "$RUN_BOOTNODE" ]; then
|
2022-10-31 17:43:49 +00:00
|
|
|
cd /opt/testnet/build/cl
|
|
|
|
python3 -m http.server 3000 &
|
|
|
|
|
|
|
|
|
2022-10-14 03:18:39 +00:00
|
|
|
cd /opt/testnet/cl
|
|
|
|
./bootnode.sh 2>&1 | tee /var/log/lighthouse_bootnode.log
|
|
|
|
else
|
|
|
|
while [ 1 -eq 1 ]; do
|
2022-10-31 17:43:49 +00:00
|
|
|
echo "Waiting on geth ..."
|
2022-10-14 03:18:39 +00:00
|
|
|
sleep 5
|
|
|
|
result=`wget --no-check-certificate --quiet \
|
|
|
|
-O - \
|
|
|
|
--method POST \
|
|
|
|
--timeout=0 \
|
|
|
|
--header 'Content-Type: application/json' \
|
2022-10-31 17:43:49 +00:00
|
|
|
--body-data '{ "jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": [] }' "${ETH1_ENDPOINT:-localhost:8545}" | jq -r '.result'`
|
2022-10-14 03:18:39 +00:00
|
|
|
if [ ! -z "$result" ] && [ "null" != "$result" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
cd /opt/testnet/cl
|
|
|
|
|
|
|
|
if [ -z "$LIGHTHOUSE_GENESIS_STATE_URL" ]; then
|
|
|
|
./reset_genesis_time.sh
|
|
|
|
else
|
|
|
|
while [ 1 -eq 1 ]; do
|
|
|
|
echo "Waiting on Genesis time ..."
|
|
|
|
sleep 5
|
|
|
|
result=`wget --no-check-certificate --quiet -O - --timeout=0 $LIGHTHOUSE_GENESIS_STATE_URL | jq -r '.data.genesis_time'`
|
|
|
|
if [ ! -z "$result" ]; then
|
2022-11-03 22:31:14 +00:00
|
|
|
./reset_genesis_time.sh $result
|
|
|
|
break;
|
2022-10-14 03:18:39 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2022-10-31 17:43:49 +00:00
|
|
|
if [ ! -z "$ENR_URL" ]; then
|
|
|
|
while [ 1 -eq 1 ]; do
|
|
|
|
echo "Waiting on ENR for boot node..."
|
|
|
|
sleep 5
|
|
|
|
result=`wget --no-check-certificate --quiet -O - --timeout=0 $ENR_URL`
|
|
|
|
if [ ! -z "$result" ]; then
|
2022-11-03 22:31:14 +00:00
|
|
|
export ENR="$result"
|
|
|
|
break;
|
2022-10-31 17:43:49 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2022-10-14 03:18:39 +00:00
|
|
|
export JWTSECRET="/opt/testnet/build/cl/jwtsecret"
|
|
|
|
echo -n "$JWT" > $JWTSECRET
|
|
|
|
|
|
|
|
./beacon_node.sh 2>&1 | tee /var/log/lighthouse_bn.log &
|
|
|
|
lpid=$!
|
|
|
|
./validator_client.sh 2>&1 | tee /var/log/lighthouse_vc.log &
|
|
|
|
vpid=$!
|
|
|
|
|
|
|
|
wait $lpid $vpid
|
|
|
|
fi
|
|
|
|
|