Skip to content

Commit

Permalink
replace USE_KOIOS_API with -n ${KOIOS_API}
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorBenson committed Aug 29, 2024
1 parent 33f626e commit c75f582
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scripts/cnode-helper-scripts/cncli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#CONFIRM_SLOT_CNT=600 # CNCLI validate: require at least these many slots to have passed before validating
#CONFIRM_BLOCK_CNT=15 # CNCLI validate: require at least these many blocks on top of minted before validating
#BATCH_AUTO_UPDATE=N # Set to Y to automatically update the script if a new version is available without user interaction
#USE_KOIOS_API=Y # Use Koios API in cncli leaderlog instead of local stake-snapshot query to reduce system resources. (default true)
#CNCLI_PROM_PORT=12799 # Set Prometheus port for cncli block metrics available through metrics operation (default: 12799)

######################################
Expand Down Expand Up @@ -141,7 +140,6 @@ getConsensus() {
}

getKoiosData() {
[[ -z ${KOIOS_API} ]] && return 1
if ! stake_snapshot=$(curl -sSL -f -d _pool_bech32=${POOL_ID_BECH32} "${KOIOS_API}/pool_stake_snapshot" 2>&1); then
echo "ERROR: Koios pool_stake_snapshot query failed: curl -sSL -f -d _pool_bech32=${POOL_ID_BECH32} ${KOIOS_API}/pool_stake_snapshot"
return 1
Expand Down Expand Up @@ -223,7 +221,6 @@ cncliInit() {
[[ -z "${CNCLI_DIR}" ]] && CNCLI_DIR="${CNODE_HOME}/guild-db/cncli"
if ! mkdir -p "${CNCLI_DIR}" 2>/dev/null; then echo "ERROR: Failed to create CNCLI DB directory: ${CNCLI_DIR}"; exit 1; fi
CNCLI_DB="${CNCLI_DIR}/cncli.db"
[[ -z "${USE_KOIOS_API}" ]] && USE_KOIOS_API=Y
[[ -z "${CNODE_HOST}" ]] && CNODE_HOST="127.0.0.1"
[[ -z "${SLEEP_RATE}" ]] && SLEEP_RATE=60
[[ -z "${CONFIRM_SLOT_CNT}" ]] && CONFIRM_SLOT_CNT=600
Expand Down Expand Up @@ -291,7 +288,7 @@ cncliLeaderlog() {
echo "Leaderlogs already calculated for epoch ${curr_epoch}, skipping!"
else
echo "Running leaderlogs for epoch ${curr_epoch}"
if [[ ${USE_KOIOS_API} = Y ]]; then
if [[ -n ${KOIOS_API} ]]; then
getKoiosData || exit 1
else
getLedgerData || exit 1
Expand Down Expand Up @@ -363,7 +360,7 @@ cncliLeaderlog() {
else continue; fi
fi
echo "Running leaderlogs for next epoch[${next_epoch}]"
if [[ ${USE_KOIOS_API} = Y ]]; then
if [[ -n ${KOIOS_API} ]]; then
if ! getKoiosData; then sleep 60; continue; fi # Sleep for 1 min before retrying to query koios again in case of error
else
if ! getLedgerData; then sleep 300; continue; fi # Sleep for 5 min before retrying to query stake snapshot in case of error
Expand Down

0 comments on commit c75f582

Please sign in to comment.