mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 06:23:47 +00:00
Merge pull request #539 from maticnetwork/manav/cherry-picks-for-qa
Merge commits to qa
This commit is contained in:
commit
f4fcfd38d5
2 changed files with 36 additions and 9 deletions
|
|
@ -535,8 +535,6 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co
|
||||||
number, hash = number-1, header.ParentHash
|
number, hash = number-1, header.ParentHash
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Snapshot has been found in", "headers depth", len(headers))
|
|
||||||
|
|
||||||
// check if snapshot is nil
|
// check if snapshot is nil
|
||||||
if snap == nil {
|
if snap == nil {
|
||||||
return nil, fmt.Errorf("Unknown error while retrieving snapshot at block number %v", number)
|
return nil, fmt.Errorf("Unknown error while retrieving snapshot at block number %v", number)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,19 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
# Instructions:
|
# Instructions:
|
||||||
# Execute `./getconfig.sh`, and follow the instructions displayed on the terminal
|
# Execute `./getconfig.sh`, and follow the instructions displayed on the terminal
|
||||||
# The `*-config.toml` file will be created in the same directory as start.sh
|
# The `*-config.toml` file will be created in the same directory as start.sh
|
||||||
# It is recommended to check the flags generated in config.toml
|
# It is recommended to check the flags generated in config.toml
|
||||||
|
|
||||||
|
# Some checks to make commands OS independent
|
||||||
|
OS="$(uname -s)"
|
||||||
|
MKTEMPOPTION=
|
||||||
|
SEDOPTION= ## Not used as of now (TODO)
|
||||||
|
shopt -s nocasematch; if [[ "$OS" == "darwin"* ]]; then
|
||||||
|
SEDOPTION="''"
|
||||||
|
MKTEMPOPTION="-t"
|
||||||
|
fi
|
||||||
|
|
||||||
read -p "* Path to start.sh: " startPath
|
read -p "* Path to start.sh: " startPath
|
||||||
# check if start.sh is present
|
# check if start.sh is present
|
||||||
|
|
@ -15,7 +24,7 @@ then
|
||||||
fi
|
fi
|
||||||
read -p "* Your validator address (e.g. 0xca67a8D767e45056DC92384b488E9Af654d78DE2), or press Enter to skip if running a sentry node: " ADD
|
read -p "* Your validator address (e.g. 0xca67a8D767e45056DC92384b488E9Af654d78DE2), or press Enter to skip if running a sentry node: " ADD
|
||||||
|
|
||||||
echo "\nThank you, your inputs are:"
|
printf "\nThank you, your inputs are:\n"
|
||||||
echo "Path to start.sh: "$startPath
|
echo "Path to start.sh: "$startPath
|
||||||
echo "Address: "$ADD
|
echo "Address: "$ADD
|
||||||
|
|
||||||
|
|
@ -26,8 +35,9 @@ if [[ -f $confPath ]]
|
||||||
then
|
then
|
||||||
echo "WARN: config.toml exists, data will be overwritten."
|
echo "WARN: config.toml exists, data will be overwritten."
|
||||||
fi
|
fi
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
tmpDir="$(mktemp -d -t ./temp-dir-XXXXXXXXXXX || oops "Can't create temporary directory")"
|
tmpDir="$(mktemp -d $MKTEMPOPTION ./temp-dir-XXXXXXXXXXX || oops "Can't create temporary directory")"
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -rf "$tmpDir"
|
rm -rf "$tmpDir"
|
||||||
}
|
}
|
||||||
|
|
@ -39,8 +49,11 @@ chmod +x $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh
|
||||||
$tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh $ADD
|
$tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh $ADD
|
||||||
rm $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh
|
rm $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh
|
||||||
|
|
||||||
|
shopt -s nocasematch; if [[ "$OS" == "darwin"* ]]; then
|
||||||
sed -i '' "s%*%'*'%g" ./temp
|
sed -i '' "s%*%'*'%g" ./temp
|
||||||
|
else
|
||||||
|
sed -i "s%*%'*'%g" ./temp
|
||||||
|
fi
|
||||||
|
|
||||||
# read the flags from `./temp`
|
# read the flags from `./temp`
|
||||||
dumpconfigflags=$(head -1 ./temp)
|
dumpconfigflags=$(head -1 ./temp)
|
||||||
|
|
@ -51,17 +64,27 @@ bash -c "$command"
|
||||||
|
|
||||||
rm ./temp
|
rm ./temp
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
if [[ -f ./tempStaticNodes.json ]]
|
if [[ -f ./tempStaticNodes.json ]]
|
||||||
then
|
then
|
||||||
echo "JSON StaticNodes found"
|
echo "JSON StaticNodes found"
|
||||||
staticnodesjson=$(head -1 ./tempStaticNodes.json)
|
staticnodesjson=$(head -1 ./tempStaticNodes.json)
|
||||||
sed -i '' "s%static-nodes = \[\]%static-nodes = \[\"${staticnodesjson}\"\]%" $confPath
|
shopt -s nocasematch; if [[ "$OS" == "darwin"* ]]; then
|
||||||
|
sed -i '' "s%static-nodes = \[\]%static-nodes = \[\"${staticnodesjson}\"\]%" $confPath
|
||||||
|
else
|
||||||
|
sed -i "s%static-nodes = \[\]%static-nodes = \[\"${staticnodesjson}\"\]%" $confPath
|
||||||
|
fi
|
||||||
rm ./tempStaticNodes.json
|
rm ./tempStaticNodes.json
|
||||||
elif [[ -f ./tempStaticNodes.toml ]]
|
elif [[ -f ./tempStaticNodes.toml ]]
|
||||||
then
|
then
|
||||||
echo "TOML StaticNodes found"
|
echo "TOML StaticNodes found"
|
||||||
staticnodestoml=$(head -1 ./tempStaticNodes.toml)
|
staticnodestoml=$(head -1 ./tempStaticNodes.toml)
|
||||||
sed -i '' "s%static-nodes = \[\]%static-nodes = \[\"${staticnodestoml}\"\]%" $confPath
|
shopt -s nocasematch; if [[ "$OS" == "darwin"* ]]; then
|
||||||
|
sed -i '' "s%static-nodes = \[\]%static-nodes = \[\"${staticnodestoml}\"\]%" $confPath
|
||||||
|
else
|
||||||
|
sed -i "s%static-nodes = \[\]%static-nodes = \[\"${staticnodestoml}\"\]%" $confPath
|
||||||
|
fi
|
||||||
rm ./tempStaticNodes.toml
|
rm ./tempStaticNodes.toml
|
||||||
else
|
else
|
||||||
echo "neither JSON nor TOML StaticNodes found"
|
echo "neither JSON nor TOML StaticNodes found"
|
||||||
|
|
@ -71,12 +94,18 @@ if [[ -f ./tempTrustedNodes.toml ]]
|
||||||
then
|
then
|
||||||
echo "TOML TrustedNodes found"
|
echo "TOML TrustedNodes found"
|
||||||
trustednodestoml=$(head -1 ./tempTrustedNodes.toml)
|
trustednodestoml=$(head -1 ./tempTrustedNodes.toml)
|
||||||
sed -i '' "s%trusted-nodes = \[\]%trusted-nodes = \[\"${trustednodestoml}\"\]%" $confPath
|
shopt -s nocasematch; if [[ "$OS" == "darwin"* ]]; then
|
||||||
|
sed -i '' "s%trusted-nodes = \[\]%trusted-nodes = \[\"${trustednodestoml}\"\]%" $confPath
|
||||||
|
else
|
||||||
|
sed -i "s%trusted-nodes = \[\]%trusted-nodes = \[\"${trustednodestoml}\"\]%" $confPath
|
||||||
|
fi
|
||||||
rm ./tempTrustedNodes.toml
|
rm ./tempTrustedNodes.toml
|
||||||
else
|
else
|
||||||
echo "neither JSON nor TOML TrustedNodes found"
|
echo "neither JSON nor TOML TrustedNodes found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
|
||||||
# comment flags in $configPath that were not passed through $startPath
|
# comment flags in $configPath that were not passed through $startPath
|
||||||
# SHA1 hash of `tempStart` -> `3305fe263dd4a999d58f96deb064e21bb70123d9`
|
# SHA1 hash of `tempStart` -> `3305fe263dd4a999d58f96deb064e21bb70123d9`
|
||||||
sed "s%bor --%go run getconfig.go ${confPath} --%" $startPath > $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh
|
sed "s%bor --%go run getconfig.go ${confPath} --%" $startPath > $tmpDir/3305fe263dd4a999d58f96deb064e21bb70123d9.sh
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue