@@ -733,40 +733,40 @@ public Pair<Boolean, byte[]> execute(byte[] data) {
733733 data = EMPTY_BYTE_ARRAY ;
734734 }
735735
736- byte [] frozenBalance = new byte [32 ];
737- System .arraycopy (data , 0 , frozenBalance , 0 , 32 );
738- byte [] frozenDuration = new byte [32 ];
739- System .arraycopy (data , 32 , frozenDuration , 0 , 32 );
740-
741- if (getDeposit ().getDbManager ().getAccountStore ().get (getCallerAddress ()).getType ()
742- == AccountType .Contract ) {
743- logger .debug ("caller can't be a contract" );
744- // TODO: or exception here.
745- return Pair .of (false , null );
746- }
747-
748- Contract .FreezeBalanceContract .Builder builder = Contract .FreezeBalanceContract .newBuilder ();
749- ByteString byteAddress = ByteString .copyFrom (getCallerAddress ());
750- builder .setOwnerAddress (byteAddress ).setFrozenBalance (ByteArray .toLong (frozenBalance ))
751- .setFrozenDuration (ByteArray .toLong (frozenDuration ));
752- FreezeBalanceContract contract = builder .build ();
753-
754- TransactionCapsule trx = new TransactionCapsule (contract , ContractType .FreezeBalanceContract );
755-
756- final List <Actuator > actuatorList = ActuatorFactory
757- .createActuator (trx , getDeposit ().getDbManager ());
758- try {
759- actuatorList .get (0 ).validate ();
760- actuatorList .get (0 ).execute (getResult ().getRet ());
761- getDeposit ()
762- .syncCacheFromAccountStore (ByteString .copyFrom (getCallerAddress ()).toByteArray ());
763- } catch (ContractExeException e ) {
764- logger .debug ("ContractExeException when calling freezeBalance in vm" );
765- logger .debug ("ContractExeException: {}" , e .getMessage ());
766- } catch (ContractValidateException e ) {
767- logger .debug ("ContractValidateException when calling freezeBalance in vm" );
768- logger .debug ("ContractValidateException: {}" , e .getMessage ());
769- }
736+ // byte[] frozenBalance = new byte[32];
737+ // System.arraycopy(data, 0, frozenBalance, 0, 32);
738+ // byte[] frozenDuration = new byte[32];
739+ // System.arraycopy(data, 32, frozenDuration, 0, 32);
740+ //
741+ // if (getDeposit().getDbManager().getAccountStore().get(getCallerAddress()).getType()
742+ // == AccountType.Contract) {
743+ // logger.debug("caller can't be a contract");
744+ // // TODO: or exception here.
745+ // return Pair.of(false, null);
746+ // }
747+ //
748+ // Contract.FreezeBalanceContract.Builder builder = Contract.FreezeBalanceContract.newBuilder();
749+ // ByteString byteAddress = ByteString.copyFrom(getCallerAddress());
750+ // builder.setOwnerAddress(byteAddress).setFrozenBalance(ByteArray.toLong(frozenBalance))
751+ // .setFrozenDuration(ByteArray.toLong(frozenDuration));
752+ // FreezeBalanceContract contract = builder.build();
753+ //
754+ // TransactionCapsule trx = new TransactionCapsule(contract, ContractType.FreezeBalanceContract);
755+ //
756+ // final List<Actuator> actuatorList = ActuatorFactory
757+ // .createActuator(trx, getDeposit().getDbManager());
758+ // try {
759+ // actuatorList.get(0).validate();
760+ // actuatorList.get(0).execute(getResult().getRet());
761+ // getDeposit()
762+ // .syncCacheFromAccountStore(ByteString.copyFrom(getCallerAddress()).toByteArray());
763+ // } catch (ContractExeException e) {
764+ // logger.debug("ContractExeException when calling freezeBalance in vm");
765+ // logger.debug("ContractExeException: {}", e.getMessage());
766+ // } catch (ContractValidateException e) {
767+ // logger.debug("ContractValidateException when calling freezeBalance in vm");
768+ // logger.debug("ContractValidateException: {}", e.getMessage());
769+ // }
770770 return Pair .of (true , new DataWord (1 ).getData ());
771771 }
772772 }
@@ -793,30 +793,37 @@ public Pair<Boolean, byte[]> execute(byte[] data) {
793793 data = EMPTY_BYTE_ARRAY ;
794794 }
795795
796- Contract .UnfreezeBalanceContract .Builder builder = Contract .UnfreezeBalanceContract
797- .newBuilder ();
798- ByteString byteAddress = ByteString .copyFrom (getCallerAddress ());
799- builder .setOwnerAddress (byteAddress );
800- UnfreezeBalanceContract contract = builder .build ();
801-
802- TransactionCapsule trx = new TransactionCapsule (contract ,
803- ContractType .UnfreezeBalanceContract );
804-
805- final List <Actuator > actuatorList = ActuatorFactory
806- .createActuator (trx , getDeposit ().getDbManager ());
807- try {
808- actuatorList .get (0 ).validate ();
809- actuatorList .get (0 ).execute (getResult ().getRet ());
810- getDeposit ()
811- .syncCacheFromAccountStore (ByteString .copyFrom (getCallerAddress ()).toByteArray ());
812- getDeposit ().syncCacheFromVotesStore (ByteString .copyFrom (getCallerAddress ()).toByteArray ());
813- } catch (ContractExeException e ) {
814- logger .debug ("ContractExeException when calling unfreezeBalance in vm" );
815- logger .debug ("ContractExeException: {}" , e .getMessage ());
816- } catch (ContractValidateException e ) {
817- logger .debug ("ContractValidateException when calling unfreezeBalance in vm" );
818- logger .debug ("ContractValidateException: {}" , e .getMessage ());
819- }
796+ // if (getDeposit().getDbManager().getAccountStore().get(getCallerAddress()).getType()
797+ // == AccountType.Contract) {
798+ // logger.debug("caller can't be a contract");
799+ // // TODO: or exception here.
800+ // return Pair.of(false, null);
801+ // }
802+ //
803+ // Contract.UnfreezeBalanceContract.Builder builder = Contract.UnfreezeBalanceContract
804+ // .newBuilder();
805+ // ByteString byteAddress = ByteString.copyFrom(getCallerAddress());
806+ // builder.setOwnerAddress(byteAddress);
807+ // UnfreezeBalanceContract contract = builder.build();
808+ //
809+ // TransactionCapsule trx = new TransactionCapsule(contract,
810+ // ContractType.UnfreezeBalanceContract);
811+ //
812+ // final List<Actuator> actuatorList = ActuatorFactory
813+ // .createActuator(trx, getDeposit().getDbManager());
814+ // try {
815+ // actuatorList.get(0).validate();
816+ // actuatorList.get(0).execute(getResult().getRet());
817+ // getDeposit()
818+ // .syncCacheFromAccountStore(ByteString.copyFrom(getCallerAddress()).toByteArray());
819+ // getDeposit().syncCacheFromVotesStore(ByteString.copyFrom(getCallerAddress()).toByteArray());
820+ // } catch (ContractExeException e) {
821+ // logger.debug("ContractExeException when calling unfreezeBalance in vm");
822+ // logger.debug("ContractExeException: {}", e.getMessage());
823+ // } catch (ContractValidateException e) {
824+ // logger.debug("ContractValidateException when calling unfreezeBalance in vm");
825+ // logger.debug("ContractValidateException: {}", e.getMessage());
826+ // }
820827 return Pair .of (true , new DataWord (1 ).getData ());
821828 }
822829 }
0 commit comments