Add support for archive node

This commit is contained in:
Prathamesh Musale 2024-06-04 14:37:34 +05:30
parent 372cace05f
commit a2abcff2a7
2 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,8 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
CERC_BSC_NETWORK: ${CERC_BSC_NETWORK:-mainnet} CERC_BSC_NETWORK: ${CERC_BSC_NETWORK:-mainnet}
CERC_GETH_GCMODE: ${CERC_GETH_GCMODE:-full}
CERC_GETH_VERBOSITY: ${CERC_GETH_VERBOSITY:-3}
volumes: volumes:
- ../config/docker-entrypoint.sh:/bsc/docker-entrypoint.sh - ../config/docker-entrypoint.sh:/bsc/docker-entrypoint.sh
- data:/data - data:/data

View File

@ -19,8 +19,14 @@ fi
# Init genesis state if geth sub dir does not exist # Init genesis state if geth sub dir does not exist
GETH_DIR=${DATA_DIR}/geth GETH_DIR=${DATA_DIR}/geth
if [ ! -d "$GETH_DIR" ]; then if [ ! -d "$GETH_DIR" ]; then
STATE_SCHEME_OPTS=""
if [ "$CERC_GETH_GCMODE" = "archive" ]; then
# Archive mode only works with state.scheme set to hash
STATE_SCHEME_OPTS="--state.scheme=hash"
fi
echo Initializing geth... echo Initializing geth...
geth --datadir ${DATA_DIR} init ${BSC_GENESIS} geth --datadir ${DATA_DIR} ${STATE_SCHEME_OPTS} init ${BSC_GENESIS}
echo Initialization done echo Initialization done
fi fi
@ -37,4 +43,8 @@ exec "geth" \
--ws.addr="0.0.0.0" \ --ws.addr="0.0.0.0" \
--ws.port 8546 \ --ws.port 8546 \
--ws.origins="*" \ --ws.origins="*" \
--gcmode=${CERC_GETH_GCMODE} \
--verbosity=${CERC_GETH_VERBOSITY} \
--metrics \
--metrics.addr="0.0.0.0" \
"$@" "$@"