Skip to content

Commit 7f2bd5b

Browse files
committed
fix: configure go relayer properly with add-paths
1 parent a7d9993 commit 7f2bd5b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

packages/cosmic-swingset/bin/ag-nchainz

+11-10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ NUM_SOLOS=1
1919
real0=$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")
2020
thisdir=$(cd "$(dirname -- "$real0")" && pwd -P)
2121

22+
PATHCONFIG=nchainz/config/paths
2223
CLI=ag-cosmos-helper
2324
DAEMON=ag-chain-cosmos
2425
SOLO=$thisdir/ag-solo
@@ -170,12 +171,12 @@ start-relayer)
170171
# Extract existing config.
171172
for path in $(jq '.paths | keys | .[]' "$cfgfile"); do
172173
rawpath=$(echo "$path" | jq -r .)
173-
jq -r ".paths[$path]" "$cfgfile" > "nchainz/config/$rawpath.json"
174+
jq -r ".paths[$path]" "$cfgfile" > "$PATHCONFIG/$rawpath.json"
174175
done
175176

176177
jqexpr=
177-
for fname in nchainz/config/*.json; do
178-
[[ -z $template || $fname == "nchainz/config/$template.json" ]] || continue
178+
for fname in $PATHCONFIG/*.json; do
179+
[[ -z $template || $fname == "$PATHCONFIG/$template.json" ]] || continue
179180
[[ $fname =~ $BASE_RE ]] || continue
180181
if grep -q '"generator": "ag-nchainz"' "$fname"; then :
181182
else
@@ -200,9 +201,9 @@ start-relayer)
200201

201202
if [[ -z $jqexpr ]]; then
202203
if [[ -n $template ]]; then
203-
echo 1>&2 "Connection ID \`$srccid' is not defined in nchainz/config/$template.json"
204+
echo 1>&2 "Connection ID \`$srccid' is not defined in $PATHCONFIG/$template.json"
204205
else
205-
echo 1>&2 "Connection ID \`$srccid' is not defined in nchainz/config/*.json"
206+
echo 1>&2 "Connection ID \`$srccid' is not defined in $PATHCONFIG/*.json"
206207
fi
207208
exit 1
208209
fi
@@ -215,23 +216,23 @@ start-relayer)
215216
echo "Replacing path \`$path'"
216217
path=$template
217218
jq -s "$jqexpr" \
218-
"nchainz/config/$template.json" "$tmpfile" > "nchainz/config/$path.json"
219+
"$PATHCONFIG/$template.json" "$tmpfile" > "$PATHCONFIG/$path.json"
219220
else
220221
# Create a new path.
221222
i=0
222223
path=path-$i
223-
while [[ -e "nchainz/config/$path.json" ]]; do
224+
while [[ -e "$PATHCONFIG/$path.json" ]]; do
224225
i=$(( $i + 1 ))
225226
path=path-$i
226227
done
227228

228229
echo "Creating new path \`$path'"
229230
jq -s "$jqexpr"' * { "generator": "ag-nchainz" }' \
230-
"nchainz/config/$template.json" "$tmpfile" > "nchainz/config/$path.json"
231+
"$PATHCONFIG/$template.json" "$tmpfile" > "$PATHCONFIG/$path.json"
231232
fi
232233

233-
echo "$ rly config add-dir nchainz/config/"
234-
rly config add-dir nchainz/config/
234+
echo "$ rly config add-paths $PATHCONFIG/"
235+
rly config add-paths $PATHCONFIG/
235236

236237
try=0
237238
while ! rly tx link $path --timeout=3s -d >> "nchainz/logs/$path.log" 2>&1; do

0 commit comments

Comments
 (0)