mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Compare commits
2 Commits
03a0c960c4
...
05748f1205
| Author | SHA1 | Date | |
|---|---|---|---|
| 05748f1205 | |||
| 6407f25caf |
@ -9,6 +9,7 @@ DEST="${HOME}/evm-blocks-testnet"
|
||||
WORKERS=512
|
||||
S3SYNC="${HOME}/.local/bin/s3sync"
|
||||
START_AT="" # default: run all
|
||||
CHUNK_SIZE=1000000 # each prefix represents this many blocks
|
||||
# ----------------
|
||||
|
||||
# parse args
|
||||
@ -87,12 +88,6 @@ install_s3sync_latest() {
|
||||
}
|
||||
|
||||
|
||||
# --- deps & install/update ---
|
||||
need aws
|
||||
install_s3sync_latest
|
||||
[[ ":$PATH:" == *":$HOME/.local/bin:"* ]] || export PATH="$HOME/.local/bin:$PATH"
|
||||
mkdir -p "$DEST"
|
||||
|
||||
# list prefixes
|
||||
log "Listing top-level prefixes in s3://${BUCKET}/"
|
||||
mapfile -t PREFIXES < <(
|
||||
@ -101,24 +96,30 @@ mapfile -t PREFIXES < <(
|
||||
)
|
||||
((${#PREFIXES[@]})) || die "No prefixes found."
|
||||
|
||||
# mark initial status
|
||||
declare -A RESULTS
|
||||
if [[ ! -n "$START_AT" ]]; then
|
||||
skipping=0
|
||||
else
|
||||
skipping=1
|
||||
# sort numerically to make order predictable
|
||||
IFS=$'\n' read -r -d '' -a PREFIXES < <(printf '%s\n' "${PREFIXES[@]}" | sort -n && printf '\0')
|
||||
|
||||
# compute the effective start prefix:
|
||||
# - if START_AT is set, floor it to the containing chunk boundary
|
||||
effective_start=""
|
||||
if [[ -n "$START_AT" ]]; then
|
||||
# numeric, base-10 safe
|
||||
start_num=$((10#$START_AT))
|
||||
chunk=$((10#$CHUNK_SIZE))
|
||||
effective_start=$(( (start_num / chunk) * chunk ))
|
||||
fi
|
||||
|
||||
# mark initial status using numeric comparisons (no ordering assumptions)
|
||||
declare -A RESULTS
|
||||
for p in "${PREFIXES[@]}"; do
|
||||
if [[ -n "$START_AT" && "$p" == "$START_AT" ]]; then
|
||||
skipping=0
|
||||
fi
|
||||
if (( skipping )); then
|
||||
if [[ -n "$effective_start" ]] && (( 10#$p < 10#$effective_start )); then
|
||||
RESULTS["$p"]="-- SKIPPED"
|
||||
else
|
||||
RESULTS["$p"]="-- TODO"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
total_start=$(date +%s)
|
||||
|
||||
for p in "${PREFIXES[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user