Skip to content

Commit a295fae

Browse files
committed
Log the date and time to make it easier to match errors to node logs
1 parent 252c97b commit a295fae

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

zebra-utils/zcash-rpc-block-template-to-proposal

+13-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ function usage()
1616
echo "$0 block-template-rpc-port proposal-rpc-port [extra-proposal-rpc-port...] -- [extra-block-template-rpc-json-fields] [extra-proposal-rpc-fields]"
1717
}
1818

19-
# Override the commands and settings used by this script using these environmental variables:
19+
# Override the commands used by this script using these environmental variables:
2020
ZCASH_CLI="${ZCASH_CLI:-zcash-cli}"
21-
TIME="time"
2221
DIFF="${DIFF:-diff --unified --color=always}"
2322
BLOCK_TEMPLATE_TO_PROPOSAL="${BLOCK_TEMPLATE_TO_PROPOSAL:-block-template-to-proposal}"
23+
# time how long a command takes to run
24+
TIME="time"
25+
# display the current date and time
26+
DATE="date --rfc-3339=seconds"
27+
28+
# Override the settings for this script using these environmental variables:
2429
TIME_SOURCES="${TIME_SOURCES:-CurTime MinTime MaxTime ClampedNow}"
2530

2631
# Process arguments
@@ -62,6 +67,8 @@ if [ $# -ge 1 ]; then
6267
exit 1
6368
fi
6469

70+
$DATE
71+
6572
# Use an easily identified temp directory name,
6673
# but fall back to the default temp name if `mktemp` does not understand `--suffix`.
6774
ZCASH_RPC_TMP_DIR=$(mktemp --suffix=.block-template-proposal -d 2>/dev/null || mktemp -d)
@@ -139,6 +146,7 @@ echo "getblocktemplate $TEMPLATE_ARG_FULL"
139146
echo
140147

141148
echo "Querying $TEMPLATE_NODE $TEMPLATE_NET chain at height >=$TEMPLATE_HEIGHT..."
149+
$DATE
142150
$TIME $ZCASH_CLI -rpcport="$TEMPLATE_RPC_PORT" getblocktemplate "$TEMPLATE_ARG_FULL" > "$TEMPLATE_NODE_TEMPLATE_RESPONSE"
143151

144152
echo "Block template data is in $TEMPLATE_NODE_TEMPLATE_RESPONSE"
@@ -173,6 +181,7 @@ echo
173181

174182
echo "getblocktemplate proposal submissions:"
175183
echo "getblocktemplate $PROPOSAL_ARG_NO_DATA"
184+
$DATE
176185
echo
177186

178187
PROPOSAL_NODES_PROPOSAL_RESPONSE_BASE="$ZCASH_RPC_TMP_DIR/proposal-check-getblocktemplate-proposal"
@@ -213,4 +222,6 @@ for RESPONSE in $PROPOSAL_NODES_PROPOSAL_RESPONSE_LIST; do
213222
fi
214223
done
215224

225+
$DATE
226+
216227
exit $EXIT_STATUS

0 commit comments

Comments
 (0)