Commit e5021e16 authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update ramdom peerid

parent 80f172ba
......@@ -6,8 +6,7 @@ isSeed=0
withParam=0
input_string_my_ip=""
input_string_connected_ip=""
input_string_enr=""
input_string_static_peer=""
if [ $# -eq 3 ]; then
......@@ -47,7 +46,7 @@ if [ $# -eq 4 ]; then
datadir=${1:-./data/}
input_string_my_ip=${2}
input_string_connected_ip=${3}
input_string_enr=${4}
input_string_static_peer=${4}
regex='^([0-9]{1,3}\.){3}[0-9]{1,3}$'
while true
do
......@@ -74,16 +73,16 @@ if [ $# -eq 4 ]; then
do
break
echo "peer----------------"
echo ${input_string_enr##*/}
echo ${input_string_enr##*/} | wc -L
echo ${input_string_static_peer##*/}
echo ${input_string_static_peer##*/} | wc -L
if [ $(echo ${input_string_enr##*/} | wc -L) -eq 53 ] ; then
if [ $(echo ${input_string_static_peer##*/} | wc -L) -eq 53 ] ; then
break
fi
echo ${input_string_enr}" is not a valid peer id"
echo ${input_string_static_peer}" is not a valid peer id"
echo "please input your p2p peer id: "
read input_string_enr
read input_string_static_peer
done
fi
......@@ -146,10 +145,10 @@ echo "isSeed " $isSeed
echo "withParam " $withParam
echo "input_string_my_ip " $input_string_my_ip
echo "input_string_connected_ip " $input_string_connected_ip
echo "input_string_enr " $input_string_enr
echo "input_string_static_peer " $input_string_static_peer
seedEnr=$input_string_enr
staticPeer=$input_string_static_peer
myIpAddr=$input_string_my_ip
connectedSentryIp=$input_string_connected_ip
......@@ -215,18 +214,8 @@ do
echo "grpc-port: 38010" >> $configFile
echo "p2p-host-ip: \"$myIpAddr\"" >> $configFile
if [ $i -eq 1 ]; then
private_key=$(python3 -c "print(hex(0xa5b18000b95e9e8e2afe5d49355b48c99aeee9e986ddc144af848847afdccccc)[2:])")
echo $private_key > $configPath/private-key
echo "p2p-priv-key: \"/root/private-key\"" >> $configFile
else
echo "input net index"
read netIndex
echo "your net index is $netIndex"
private_key=$(python3 -c "print(hex(0xa5b18000b95e9e8e2afe5d49355b48c99aeee9e986ddc144af848847afdccccc + $netIndex)[2:])")
echo $private_key > $configPath/private-key
echo "p2p-priv-key: \"/root/private-key\"" >> $configFile
echo "peer: [\"${seedEnr}\"]" >> $configFile
if [ $i -ne 1 ]; then
echo "peer: [\"${staticPeer}\"]" >> $configFile
fi
# echo "peer: \"$ipAddr\"" >> $configFile
# peer: ["要连接的peerid"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment