mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 18:51:19 +00:00
5b5cae693f
Events with just 1 argument fail before this change Former-commit-id: 69cbb51c56054208417e464dc6e46a94ccb3bbeb [formerly fbb03244929beb0ce8f9c607ce33d107e8319b89] Former-commit-id: 984154c1ba79f1fe8bf0106a604b2765ea312079
41 lines
753 B
Bash
Executable File
41 lines
753 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Boot a ping-pong network simulation using the HTTP API started by ping-pong.go
|
|
|
|
set -e
|
|
|
|
main() {
|
|
if ! which p2psim &>/dev/null; then
|
|
fail "missing p2psim binary (you need to build cmd/p2psim and put it in \$PATH)"
|
|
fi
|
|
|
|
info "creating 10 nodes"
|
|
for i in $(seq 1 10); do
|
|
p2psim node create --name "$(node_name $i)"
|
|
p2psim node start "$(node_name $i)"
|
|
done
|
|
|
|
info "connecting node01 to all other nodes"
|
|
for i in $(seq 2 10); do
|
|
p2psim node connect "node01" "$(node_name $i)"
|
|
done
|
|
|
|
info "done"
|
|
}
|
|
|
|
node_name() {
|
|
local num=$1
|
|
echo "node$(printf '%02d' $num)"
|
|
}
|
|
|
|
info() {
|
|
echo -e "\033[1;32m---> $(date +%H:%M:%S) ${@}\033[0m"
|
|
}
|
|
|
|
fail() {
|
|
echo -e "\033[1;31mERROR: ${@}\033[0m" >&2
|
|
exit 1
|
|
}
|
|
|
|
main "$@"
|