From 2f49b06152587be19cf5d91b88b6b04d42c8d4bf Mon Sep 17 00:00:00 2001 From: Carla Kirk-Cohen Date: Wed, 10 Apr 2024 17:10:58 -0400 Subject: [PATCH] scripts: include list of node pubkeys in credentials export This is information that we can only get with warcli, so we copy it across while we're working externally with our credentials copying. --- scripts/credentials.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/credentials.sh b/scripts/credentials.sh index 093b6f5..cc6db45 100755 --- a/scripts/credentials.sh +++ b/scripts/credentials.sh @@ -9,4 +9,14 @@ kubectl cp warnet-armada/lnd0:root/.lnd/data/chain/bitcoin/regtest/admin.macaroo kubectl cp warnet-armada/lnd1:root/.lnd/data/chain/bitcoin/regtest/admin.macaroon $tmp_dir/lnd1-admin.macaroon kubectl cp warnet-armada/lnd2:root/.lnd/data/chain/bitcoin/regtest/admin.macaroon $tmp_dir/lnd2-admin.macaroon -kubectl cp $tmp_dir warnet-armada/flagship:/credentials \ No newline at end of file +# In addition to our credentials, we'll create a list of pubkeys/ips to connect to. +json_data=$(warcli lncli 0 describegraph) +pub_keys=$(echo "$json_data" | jq -r '.nodes[] | select(.addresses != null and .addresses != []) | .pub_key') +addrs=$(echo "$json_data" | jq -r '.nodes[] | select(.addresses != null and .addresses != []) | .addresses[].addr') + +# Loop through each entry and print pub_key and addr +for i in $(seq 1 $(($(echo "$pub_keys" | wc -l)-1))); do + echo "$(echo "$pub_keys" | sed -n ${i}p)@$(echo "$addrs" | sed -n ${i}p)" >> "$tmp_dir"/nodes.txt +done + +kubectl cp $tmp_dir warnet-armada/flagship:/credentials