6363 __network=" --network ${NETWORK} "
6464fi
6565
66- if [[ " ${ARCHIVE_NODE} " = " true" ]]; then
67- echo " Besu archive node without pruning"
68- __prune=" --data-storage-format=FOREST --sync-mode=FULL"
69- elif [[ " ${MINIMAL_NODE} " = " true" ]]; then
70- case " ${NETWORK} " in
71- mainnet | sepolia )
72- echo " Besu minimal node with pre-merge history expiry"
73- __prune=" --snapsync-server-enabled"
74- timestamp_file=" /var/lib/besu/prune-history-timestamp.txt"
75- if [[ -f " ${timestamp_file} " ]]; then
76- saved_ts=$( < " ${timestamp_file} " )
77- current_ts=$( date +%s)
78- diff=$(( current_ts - saved_ts))
66+ case " ${NODE_TYPE} " in
67+ archive)
68+ echo " Besu archive node without pruning"
69+ __prune=" --data-storage-format=FOREST --sync-mode=FULL"
70+ ;;
71+ full)
72+ echo " Besu full node without history expiry"
73+ __prune=" --snapsync-synchronizer-pre-checkpoint-headers-only-enabled=false --snapsync-server-enabled"
74+ ;;
75+ pre-merge-expiry)
76+ case " ${NETWORK} " in
77+ mainnet|sepolia)
78+ echo " Besu minimal node with pre-merge history expiry"
79+ __prune=" --snapsync-server-enabled"
80+ timestamp_file=" /var/lib/besu/prune-history-timestamp.txt"
81+ if [[ -f " ${timestamp_file} " ]]; then
82+ saved_ts=$( < " ${timestamp_file} " )
83+ current_ts=$( date +%s)
84+ diff=$(( current_ts - saved_ts))
7985
80- if (( diff >= 172800 )) ; then # 48 * 60 * 60 - 48 hours have passed
81- rm -f " ${timestamp_file} "
82- else
83- echo " Enabling RocksDB garbage collection after history prune. You should see Besu DB space usage go down."
84- echo " This may take 6-12 hours. Eth Docker will keep RocksDB garbage collection on for 48 hours."
85- __prune+=" --history-expiry-prune"
86+ if (( diff >= 172800 )) ; then # 48 * 60 * 60 - 48 hours have passed
87+ rm -f " ${timestamp_file} "
88+ else
89+ echo " Enabling RocksDB garbage collection after history prune. You should see Besu DB space usage go down."
90+ echo " This may take 6-12 hours. Eth Docker will keep RocksDB garbage collection on for 48 hours."
91+ __prune+=" --history-expiry-prune"
92+ fi
8693 fi
87- fi
88- ;;
89- * )
90- echo " There is no pre-merge history for ${NETWORK} network, EL_MINIMAL_NODE has no effect."
91- __prune=" "
92- ;;
93- esac
94- else
95- echo " Besu full node without history expiry"
96- __prune=" --snapsync-synchronizer-pre-checkpoint-headers-only-enabled=false --snapsync-server-enabled"
97- fi
94+ ;;
95+ * )
96+ echo " There is no pre-merge history for ${NETWORK} network, \" pre-merge-expiry\" has no effect."
97+ __prune=" "
98+ ;;
99+ esac
100+ ;;
101+ * )
102+ echo " ERROR: The node type ${NODE_TYPE} is not known to Eth Docker's Besu implementation."
103+ sleep 30
104+ exit 1
105+ ;;
106+ esac
98107
99108# New or old datadir
100109if [[ -d /var/lib/besu-og/database ]]; then
@@ -116,7 +125,7 @@ set -- "${__args[@]}"
116125
117126if [[ -f /var/lib/besu/prune-history-marker ]]; then
118127 rm -f /var/lib/besu/prune-history-marker
119- if [[ " ${ARCHIVE_NODE } " = " true " ]]; then
128+ if [[ " ${NODE_TYPE } " = " archive " ]]; then
120129 echo " Besu is an archive node. Not attempting to prune history: Aborting."
121130 exit 1
122131 fi
@@ -127,7 +136,7 @@ if [[ -f /var/lib/besu/prune-history-marker ]]; then
127136 exec /opt/besu/bin/besu ${__datadir} ${__network} storage prune-pre-merge-blocks
128137elif [[ -f /var/lib/besu/prune-marker ]]; then
129138 rm -f /var/lib/besu/prune-marker
130- if [[ " ${ARCHIVE_NODE } " = " true " ]]; then
139+ if [[ " ${NODE_TYPE } " = " archive " ]]; then
131140 echo " Besu is an archive node. Not attempting to prune trie-logs: Aborting."
132141 exit 1
133142 fi
0 commit comments