File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 2020 env :
2121 BLOCK_COUNT : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.block_count || '1' }}
2222 BLOCKTANK_SERVER : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.blocktank_server || 'https://api.stag0.blocktank.to/blocktank/api/v2' }}
23+ MEMPOOL_API : https://mempool.bitkit.stag0.blocktank.to/api/blocks/tip/height
2324 steps :
2425 - name : Validate params
2526 run : |
3940 echo "BLOCKTANK_SERVER is empty" >&2
4041 exit 1
4142 fi
43+ - name : Capture initial tip height
44+ run : |
45+ TIP_BEFORE=$(curl -sS "${MEMPOOL_API}" | tr -dc '0-9')
46+ if [[ -z "${TIP_BEFORE}" ]]; then
47+ echo "Failed to obtain initial block height" >&2
48+ exit 1
49+ fi
50+ echo "Initial tip height: ${TIP_BEFORE}"
51+ echo "TIP_BEFORE=${TIP_BEFORE}" >> "${GITHUB_ENV}"
4252 - name : Mine regtest blocks
4353 run : |
4454 echo "Mining ${BLOCK_COUNT} block(s) on regtest..."
4757 "${BLOCKTANK_SERVER}/regtest/chain/mine" \
4858 -H 'Content-Type: application/json' \
4959 -d "{\"count\": ${BLOCK_COUNT}}"
60+ - name : Verify new tip height
61+ run : |
62+ TIP_AFTER=$(curl -sS "${MEMPOOL_API}" | tr -dc '0-9')
63+ if [[ -z "${TIP_AFTER}" ]]; then
64+ echo "Failed to obtain post-mining block height" >&2
65+ exit 1
66+ fi
67+ echo "New tip height: ${TIP_AFTER}"
68+ EXPECTED=$((TIP_BEFORE + BLOCK_COUNT))
69+ if (( TIP_AFTER < EXPECTED )); then
70+ echo "Tip height ${TIP_AFTER} is less than expected ${EXPECTED}" >&2
71+ exit 1
72+ fi
73+ echo "Regtest height increased as expected"
You can’t perform that action at this time.
0 commit comments