mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-28 16:58:03 +01:00
i2p: limit addseednodes to 21 new peers, format script (#4641)
* i2p: limit addseednodes to 21 new peers, format script
This commit is contained in:
parent
9a2de6cad5
commit
40e970d828
1 changed files with 58 additions and 48 deletions
|
@ -9,7 +9,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|||
echo "blitz.i2pd.sh install -> Install i2pd"
|
||||
echo "blitz.i2pd.sh on -> Switch on i2pd"
|
||||
echo "blitz.i2pd.sh off -> Uninstall i2pd"
|
||||
echo "blitz.i2pd.sh addseednodes -> Add all I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
|
||||
echo "blitz.i2pd.sh addseednodes -> Add 21 randonly selected I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
|
||||
echo "blitz.i2pd.sh status -> I2P related logs from bitcoind, bitcoin-cli -netinfo 4 and webconsole access"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -111,7 +111,7 @@ echo "# Running: 'blitz.i2pd.sh $*'"
|
|||
source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# make sure to be present in PATH
|
||||
if ! echo "$PATH" | grep "/usr/sbin"; then
|
||||
if ! echo "$PATH" | grep "/usr/sbin" >/dev/null; then
|
||||
export PATH=$PATH:/usr/sbin
|
||||
echo "PATH=\$PATH:/usr/sbin" | sudo tee -a /etc/profile
|
||||
fi
|
||||
|
@ -222,20 +222,30 @@ fi
|
|||
|
||||
if [ "$1" = "addseednodes" ]; then
|
||||
|
||||
if ! sudo -u bitcoin bitcoin-cli -netinfo 4 | grep i2p; then
|
||||
/home/admin/config.scripts/blitz.i2pd.sh on
|
||||
fi
|
||||
echo "Add 21 randomly selected I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
|
||||
echo "Monitor in a new terminal with:"
|
||||
echo "watch sudo -u bitcoin bitcoin-cli -netinfo 4"
|
||||
echo "This will take some time ..."
|
||||
|
||||
echo "Add all I2P seed nodes from: https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/nodes_main.txt"
|
||||
# Fetch and filter the list of seed nodes
|
||||
i2pSeedNodeList=$(curl -sS https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt | grep .b32.i2p:0)
|
||||
for i2pSeedNode in ${i2pSeedNodeList}; do
|
||||
bitcoin-cli addnode "$i2pSeedNode" "onetry"
|
||||
|
||||
# Shuffle the list and pick the first 21 nodes
|
||||
selectedNodes=$(echo "$i2pSeedNodeList" | shuf | head -n 21)
|
||||
|
||||
# Add each selected node
|
||||
for i2pSeedNode in ${selectedNodes}; do
|
||||
echo "# Add i2p seed node: ${i2pSeedNode} by running:"
|
||||
echo "bitcoin-cli addnode $i2pSeedNode onetry"
|
||||
sudo -u bitcoin bitcoin-cli addnode "$i2pSeedNode" "onetry"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "# Display sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p"
|
||||
sudo tail -n 100 /mnt/hdd/bitcoin/debug.log | grep i2p
|
||||
echo
|
||||
echo "# Display bitcoin-cli -netinfo 4"
|
||||
bitcoin-cli -netinfo 4
|
||||
sudo -u bitcoin bitcoin-cli -netinfo 4
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue