File tree Expand file tree Collapse file tree
chainbase/src/main/java/org/tron/core/db2/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -471,9 +471,10 @@ private void pruneCheckpoint() {
471471 if (cpList .size () < 3 ) {
472472 return ;
473473 }
474+ long latestTimestamp = Long .parseLong (cpList .get (cpList .size ()-1 ));
474475 for (String cp : cpList .subList (0 , cpList .size ()-3 )) {
475476 long timestamp = Long .parseLong (cp );
476- if (System . currentTimeMillis () - timestamp < ONE_MINUTE_MILLS *2 ) {
477+ if (latestTimestamp - timestamp <= ONE_MINUTE_MILLS *2 ) {
477478 break ;
478479 }
479480 String checkpointPath = Paths .get (StorageUtils .getOutputDirectoryByDbName (CHECKPOINT_V2_DIR ),
@@ -522,7 +523,12 @@ private void checkV2() {
522523 return ;
523524 }
524525
526+ long latestTimestamp = Long .parseLong (cpList .get (cpList .size ()-1 ));
525527 for (String cp : cpList ) {
528+ long timestamp = Long .parseLong (cp );
529+ if (latestTimestamp - timestamp > ONE_MINUTE_MILLS *2 ) {
530+ continue ;
531+ }
526532 TronDatabase <byte []> checkPointV2Store = getCheckpointDB (cp );
527533 recover (checkPointV2Store );
528534 checkPointV2Store .close ();
You can’t perform that action at this time.
0 commit comments