3232import org .tron .protos .Protocol .AccountType ;
3333import org .tron .protos .Protocol .Transaction .Result .code ;
3434
35+ import static org .tron .core .zen .note .ZenChainParams .*;
36+
3537
3638@ Slf4j (topic = "actuator" )
3739public class ShieldedTransferActuator extends AbstractActuator {
@@ -56,7 +58,8 @@ public boolean execute(TransactionResultCapsule ret)
5658 executeTransparentFrom (shieldedTransferContract .getTransparentFromAddress ().toByteArray (),
5759 shieldedTransferContract .getFromAmount (), ret );
5860 }
59- dbManager .adjustAssetBalanceV2 (dbManager .getAccountStore ().getBlackhole ().createDbKey (), zenTokenId , fee );
61+ dbManager .adjustAssetBalanceV2 (dbManager .getAccountStore ().getBlackhole ().createDbKey (),
62+ zenTokenId , fee );
6063 } catch (BalanceInsufficientException e ) {
6164 logger .debug (e .getMessage (), e );
6265 ret .setStatus (fee , code .FAILED );
@@ -242,9 +245,9 @@ public boolean validate() throws ContractValidateException {
242245 }
243246
244247 for (ReceiveDescription receiveDescription : receiveDescriptions ) {
245- if (receiveDescription .getCEnc ().size () != 580
246- || receiveDescription .getCOut ().size () != 80 ) {
247- throw new ContractValidateException ("receive description null " );
248+ if (receiveDescription .getCEnc ().size () != ZC_ENCCIPHERTEXT_SIZE
249+ || receiveDescription .getCOut ().size () != ZC_OUTCIPHERTEXT_SIZE ) {
250+ throw new ContractValidateException ("Cout or CEnc size error " );
248251 }
249252 if (!Librustzcash .librustzcashSaplingCheckOutput (
250253 new CheckOutputParams (ctx ,
@@ -351,7 +354,7 @@ private void validateTransparent(ShieldedTransferContract shieldedTransferContra
351354 throw new ContractValidateException ("no transparent_to_address, to_amount should be 0" );
352355 }
353356 if (hasTransparentFrom && hasTransparentTo && Arrays .equals (toAddress , ownerAddress )) {
354- throw new ContractValidateException ("Can't transfer trx to yourself" );
357+ throw new ContractValidateException ("Can't transfer zen to yourself" );
355358 }
356359
357360 if (hasTransparentFrom ) {
@@ -402,13 +405,6 @@ public ByteString getOwnerAddress() throws InvalidProtocolBufferException {
402405 @ Override
403406 public long calcFee () {
404407 long fee = 0 ;
405- // byte[] toAddress = shieldedTransferContract.getTransparentToAddress().toByteArray();
406- // if (Wallet.addressValid(toAddress)) {
407- // AccountCapsule transparentToAccount = dbManager.getAccountStore().get(toAddress);
408- // if (transparentToAccount == null) {
409- // fee = dbManager.getDynamicPropertiesStore().getCreateAccountFee();
410- // }
411- // }
412408 fee += dbManager .getDynamicPropertiesStore ().getShieldedTransactionFee ();
413409 return fee ;
414410 }
0 commit comments