11package org .tron .core .store ;
22
3+ import static org .tron .core .config .Parameter .ChainConstant .DELEGATE_PERIOD ;
4+
35import com .google .protobuf .ByteString ;
46import java .util .Arrays ;
57import java .util .Optional ;
@@ -948,6 +950,20 @@ private DynamicPropertiesStore(@Value("properties") String dbName) {
948950 } catch (IllegalArgumentException e ) {
949951 this .saveDynamicEnergyMaxFactor (CommonParameter .getInstance ().getDynamicEnergyMaxFactor ());
950952 }
953+
954+ try {
955+ this .getAllowCancelAllUnfreezeV2 ();
956+ } catch (IllegalArgumentException e ) {
957+ this .saveAllowCancelAllUnfreezeV2 (
958+ CommonParameter .getInstance ().getAllowCancelAllUnfreezeV2 ()
959+ );
960+ }
961+
962+ try {
963+ this .getMaxDelegateLockPeriod ();
964+ } catch (IllegalArgumentException e ) {
965+ this .saveMaxDelegateLockPeriod (DELEGATE_PERIOD / 3000 );
966+ }
951967 }
952968
953969 public String intArrayToString (int [] a ) {
@@ -2792,7 +2808,7 @@ public long getAllowCancelAllUnfreezeV2() {
27922808 return Optional .ofNullable (getUnchecked (ALLOW_CANCEL_ALL_UNFREEZE_V2 ))
27932809 .map (BytesCapsule ::getData )
27942810 .map (ByteArray ::toLong )
2795- .orElse ( CommonParameter . getInstance (). getAllowCancelAllUnfreezeV2 ( ));
2811+ .orElseThrow (() -> new IllegalArgumentException ( "not found ALLOW_CANCEL_ALL_UNFREEZE_V2" ));
27962812 }
27972813
27982814 public boolean supportAllowCancelAllUnfreezeV2 () {
@@ -2808,11 +2824,11 @@ public long getMaxDelegateLockPeriod() {
28082824 return Optional .ofNullable (getUnchecked (MAX_DELEGATE_LOCK_PERIOD ))
28092825 .map (BytesCapsule ::getData )
28102826 .map (ByteArray ::toLong )
2811- .orElse ( CommonParameter . getInstance (). getMaxDelegateLockPeriod ( ));
2827+ .orElseThrow (() -> new IllegalArgumentException ( "not found MAX_DELEGATE_LOCK_PERIOD" ));
28122828 }
28132829
28142830 public boolean supportMaxDelegateLockPeriod () {
2815- return getMaxDelegateLockPeriod () > 0 && getUnfreezeDelayDays () > 0 ;
2831+ return ( getMaxDelegateLockPeriod () > DELEGATE_PERIOD / 3000 ) && getUnfreezeDelayDays () > 0 ;
28162832 }
28172833
28182834 private static class DynamicResourceProperties {
0 commit comments