From 1d8bfd8c0d7543003f264ae95259c333f81b01a2 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 25 Nov 2019 21:56:28 +0200 Subject: [PATCH] Allow overriding the bootstrap node in run_node.sh --- beacon_chain/eth2_network.nim | 2 +- tests/simulation/run_node.sh | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index b560279bf..4b76a6fca 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -272,7 +272,7 @@ else: proc saveConnectionAddressFile*(node: Eth2Node, filename: string) = let id = waitFor node.daemon.identity() - Json.saveFile(filename, id, pretty = false) + writeFile(filename, $id.addresses[0] & "/p2p/" & id.peer.pretty) proc loadConnectionAddressFile*(filename: string): PeerInfo = Json.loadFile(filename, PeerInfo) diff --git a/tests/simulation/run_node.sh b/tests/simulation/run_node.sh index e1c10573e..43c778a56 100755 --- a/tests/simulation/run_node.sh +++ b/tests/simulation/run_node.sh @@ -9,6 +9,15 @@ shift # shellcheck source=/dev/null source "$(dirname "$0")/vars.sh" +if [[ ! -z "$1" ]]; then + BOOTSTRAP_NODE_ID=$1 + BOOTSTRAP_ADDRESS_FILE="${SIMULATION_DIR}/node-${BOOTSTRAP_NODE_ID}/beacon_node.address" + shift +else + BOOTSTRAP_NODE_ID=$MASTER_NODE + BOOTSTRAP_ADDRESS_FILE=$NETWORK_BOOTSTRAP_FILE +fi + # set up the environment # shellcheck source=/dev/null source "${SIM_ROOT}/../../env.sh" @@ -36,7 +45,7 @@ if [[ $NODE_ID -lt $TOTAL_NODES ]]; then fi $BEACON_NODE_BIN \ - --bootstrap-file=$NETWORK_BOOTSTRAP_FILE \ + --bootstrap-file=$BOOTSTRAP_ADDRESS_FILE \ --data-dir=$DATA_DIR \ --node-name=$NODE_ID \ --tcp-port=$PORT \