Skip to content

Commit

Permalink
Merge of #7500
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 7, 2023
2 parents 29d8e90 + 8308526 commit 928cf64
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions zebra-utils/zcash-rpc-diff
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ JQ="${JQ:-jq}"
# - Use `-rpccookiefile=your/cookie/file` for a cookie file.
# - Use `-rpcpassword=your-password` for a password.
ZCASHD_EXTRA_ARGS="${ZCASHD_EXTRA_ARGS:-}"
# We show this many lines of data, removing excess lines from the middle of the output.
OUTPUT_DATA_LINE_LIMIT="${OUTPUT_DATA_LINE_LIMIT:-40}"

if [ $# -lt 2 ]; then
usage
Expand Down Expand Up @@ -114,8 +116,15 @@ $DIFF "$ZEBRAD_RESPONSE" "$ZCASHD_RESPONSE" \
&& ( \
echo "RPC responses were identical"; \
echo ; \
echo "$ZEBRAD_RESPONSE:"; \
cat "$ZEBRAD_RESPONSE"; \
echo "$ZEBRAD_RESPONSE, limited to $OUTPUT_DATA_LINE_LIMIT lines:"; \
export ZEBRAD_RESPONSE=$ZEBRAD_RESPONSE
if [[ $(cat "$ZEBRAD_RESPONSE" | wc -l) -gt $OUTPUT_DATA_LINE_LIMIT ]]; then \
cat "$ZEBRAD_RESPONSE" | head -$((OUTPUT_DATA_LINE_LIMIT / 2)) || true; \
echo "..."; \
cat "$ZEBRAD_RESPONSE" | tail -$((OUTPUT_DATA_LINE_LIMIT / 2)) || true; \
else \
cat "$ZEBRAD_RESPONSE"; \
fi; \
)

EXIT_STATUS=$?
Expand Down Expand Up @@ -159,8 +168,15 @@ $DIFF "$ZEBRAD_CHECK_RESPONSE" "$ZCASHD_CHECK_RESPONSE" \
&& ( \
echo "RPC check responses were identical"; \
echo ; \
echo "$ZEBRAD_CHECK_RESPONSE:"; \
cat "$ZEBRAD_CHECK_RESPONSE"; \
echo "$ZEBRAD_CHECK_RESPONSE, limited to $OUTPUT_DATA_LINE_LIMIT lines:"; \
export ZEBRAD_CHECK_RESPONSE=$ZEBRAD_CHECK_RESPONSE
if [[ $(cat "$ZEBRAD_CHECK_RESPONSE" | wc -l) -gt $OUTPUT_DATA_LINE_LIMIT ]]; then \
cat "$ZEBRAD_CHECK_RESPONSE" | head -$((OUTPUT_DATA_LINE_LIMIT / 2)) || true; \
echo "..."; \
cat "$ZEBRAD_CHECK_RESPONSE" | tail -$((OUTPUT_DATA_LINE_LIMIT / 2)) || true; \
else \
cat "$ZEBRAD_CHECK_RESPONSE"; \
fi; \
)

CHECK_EXIT_STATUS=$?
Expand Down Expand Up @@ -194,8 +210,15 @@ if [ "$1" == "getaddressbalance" ]; then
&& ( \
echo "RPC balances were identical"; \
echo ; \
echo "$ZEBRAD_NUM_RESPONSE:"; \
cat "$ZEBRAD_NUM_RESPONSE"; \
echo "$ZEBRAD_NUM_RESPONSE, limited to $OUTPUT_DATA_LINE_LIMIT lines:"; \
export ZEBRAD_NUM_RESPONSE=$ZEBRAD_NUM_RESPONSE
if [[ $(cat "$ZEBRAD_NUM_RESPONSE" | wc -l) -gt $OUTPUT_DATA_LINE_LIMIT ]]; then \
cat "$ZEBRAD_NUM_RESPONSE" | head -$((OUTPUT_DATA_LINE_LIMIT / 2)) || true; \
echo "..."; \
cat "$ZEBRAD_NUM_RESPONSE" | tail -$((OUTPUT_DATA_LINE_LIMIT / 2)) || true; \
else \
cat "$ZEBRAD_NUM_RESPONSE"; \
fi; \
)

COMPARE_EXIT_STATUS=$?
Expand Down

0 comments on commit 928cf64

Please sign in to comment.