Skip to content

Commit 3896703

Browse files
authored
feat: include ancillary key in mithril-client command (#278)
Signed-off-by: Reza Rajan <[email protected]>
1 parent eafd311 commit 3896703

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

bin/run-network

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ if ! test -e /data/db/protocolMagicId; then
2828
esac
2929
if [[ ${__skip} != true ]]; then
3030
export GENESIS_VERIFICATION_KEY=$(</opt/cardano/config/${NETWORK}/genesis.vkey)
31+
export ANCILLARY_VERIFICATION_KEY=$(</opt/cardano/config/${NETWORK}/ancillary.vkey)
3132
export AGGREGATOR_ENDPOINT=https://aggregator.${__path}.api.mithril.network/aggregator
3233
export SNAPSHOT_DIGEST=$(mithril-client cardano-db snapshot list --json | jq -r '.[0].digest')
3334
mkdir -p /data
3435
cd /data
35-
echo "Starting: /usr/local/bin/mithril-client cardano-db download ${SNAPSHOT_DIGEST}"
36+
echo "Starting: /usr/local/bin/mithril-client cardano-db download ${SNAPSHOT_DIGEST} ${ANCILLARY_VERIFICATION_KEY:+--include-ancillary}"
3637
# Handle SIGTERM during initial sync
3738
trap 'kill -TERM $(pidof mithril-client)' TERM
3839
# Run mithril-client in the background so we can capture the PID and wait
39-
mithril-client cardano-db download ${SNAPSHOT_DIGEST} &
40+
mithril-client cardano-db download "${SNAPSHOT_DIGEST}" ${ANCILLARY_VERIFICATION_KEY:+--include-ancillary} &
4041
_mithril_pid=$!
4142
wait $_mithril_pid || exit $?
4243
# Reset signal handler and wait again (to avoid race condition)

bin/run-node

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ case ${CARDANO_NETWORK} in
7272
esac
7373
AGGREGATOR_ENDPOINT=${AGGREGATOR_ENDPOINT:-https://aggregator.${__path}.api.mithril.network/aggregator}
7474
GENESIS_VERIFICATION_KEY_PATH=${GENESIS_VERIFICATION_KEY_PATH:-${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/genesis.vkey}
75+
ANCILLARY_VERIFICATION_KEY_PATH=${ANCILLARY_VERIFICATION_KEY_PATH:-${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/ancillary.vkey}
7576
if [[ -z $GENESIS_VERIFICATION_KEY && -f $GENESIS_VERIFICATION_KEY_PATH ]]; then
7677
GENESIS_VERIFICATION_KEY=$(<${GENESIS_VERIFICATION_KEY_PATH})
7778
fi
79+
if [[ -z $ANCILLARY_VERIFICATION_KEY && -f $ANCILLARY_VERIFICATION_KEY_PATH ]]; then
80+
ANCILLARY_VERIFICATION_KEY=$(<${ANCILLARY_VERIFICATION_KEY_PATH})
81+
fi
7882
SNAPSHOT_DIGEST=${SNAPSHOT_DIGEST:-latest}
7983
RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-true}
8084

@@ -112,6 +116,7 @@ fi
112116

113117
echo AGGREGATOR_ENDPOINT=${AGGREGATOR_ENDPOINT}
114118
echo GENESIS_VERIFICATION_KEY=${GENESIS_VERIFICATION_KEY}
119+
echo ANCILLARY_VERIFICATION_KEY=${ANCILLARY_VERIFICATION_KEY}
115120
echo SNAPSHOT_DIGEST=${SNAPSHOT_DIGEST}
116121
echo RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT}
117122

@@ -123,15 +128,15 @@ if ! test -e ${CARDANO_DATABASE_PATH}/protocolMagicId; then
123128
if [[ ${RESTORE_SNAPSHOT} == true ]]; then
124129
mkdir -p $(dirname ${CARDANO_DATABASE_PATH})
125130
cd $(dirname ${CARDANO_DATABASE_PATH})
126-
export AGGREGATOR_ENDPOINT GENESIS_VERIFICATION_KEY SNAPSHOT_DIGEST
127-
echo "Starting: /usr/local/bin/mithril-client cardano-db download ${SNAPSHOT_DIGEST}"
131+
export AGGREGATOR_ENDPOINT GENESIS_VERIFICATION_KEY ANCILLARY_VERIFICATION_KEY SNAPSHOT_DIGEST
132+
echo "Starting: /usr/local/bin/mithril-client cardano-db download ${SNAPSHOT_DIGEST} ${ANCILLARY_VERIFICATION_KEY:+--include-ancillary}"
128133
if [[ $(cd ${CARDANO_DATABASE_PATH} 2>/dev/null; pwd -P) != $(pwd -P)/db ]]; then
129134
rm -rf db/*
130135
fi
131136
# Handle SIGTERM during initial sync
132137
trap 'kill -TERM $(pidof mithril-client)' TERM
133138
# Run mithril-client in the background so we can capture the PID and wait
134-
mithril-client cardano-db download ${SNAPSHOT_DIGEST} &
139+
mithril-client cardano-db download "${SNAPSHOT_DIGEST}" ${ANCILLARY_VERIFICATION_KEY:+--include-ancillary} &
135140
_mithril_pid=$!
136141
wait $_mithril_pid || exit $?
137142
# Reset signal handler and wait again (to avoid race condition)

0 commit comments

Comments
 (0)