|
26 | 26 | import static org.apache.commons.lang3.ArrayUtils.nullToEmpty; |
27 | 27 | import static org.tron.common.runtime.utils.MUtil.convertToTronAddress; |
28 | 28 | import static org.tron.common.runtime.utils.MUtil.transfer; |
29 | | -import static org.tron.common.runtime.utils.MUtil.transferValidate; |
30 | 29 | import static org.tron.common.utils.BIUtil.isPositive; |
31 | 30 | import static org.tron.common.utils.BIUtil.toBI; |
32 | 31 |
|
|
65 | 64 | import org.tron.common.utils.FastByteComparisons; |
66 | 65 | import org.tron.common.utils.Sha256Hash; |
67 | 66 | import org.tron.common.utils.Utils; |
| 67 | +import org.tron.core.actuator.TransferActuator; |
68 | 68 | import org.tron.core.capsule.AccountCapsule; |
69 | 69 | import org.tron.core.capsule.BlockCapsule; |
70 | 70 | import org.tron.core.config.args.Args; |
@@ -462,7 +462,10 @@ public void createContract(DataWord value, DataWord memStart, DataWord memSize) |
462 | 462 | // [4] TRANSFER THE BALANCE |
463 | 463 | long newBalance = 0L; |
464 | 464 | if (!byTestingSuite()) { |
465 | | - transferValidate(deposit, senderAddress, newAddress, endowment); |
| 465 | + if (!TransferActuator.validate(deposit, senderAddress, newAddress, endowment)){ |
| 466 | + throw new RuntimeException( |
| 467 | + Hex.toHexString(senderAddress).toUpperCase() + " transfer to" +Hex.toHexString(newAddress).toUpperCase() +" validation fail!"); |
| 468 | + } |
466 | 469 | deposit.addBalance(senderAddress, -endowment); |
467 | 470 | newBalance = deposit.addBalance(newAddress, endowment); |
468 | 471 | } |
@@ -617,7 +620,10 @@ public void callToAddress(MessageCall msg) |
617 | 620 | msg.getGas().getNoLeadZeroesData(), |
618 | 621 | msg.getEndowment().getNoLeadZeroesData()); |
619 | 622 | } else if(!ArrayUtils.isEmpty(senderAddress) && !ArrayUtils.isEmpty(contextAddress) && senderAddress != contextAddress && endowment > 0) { |
620 | | - transferValidate(deposit,senderAddress,contextAddress,endowment); |
| 623 | + if (!TransferActuator.validate(deposit, senderAddress, contextAddress, endowment)){ |
| 624 | + throw new RuntimeException( |
| 625 | + Hex.toHexString(senderAddress).toUpperCase() + " transfer to" +Hex.toHexString(contextAddress).toUpperCase() +" validation fail!"); |
| 626 | + } |
621 | 627 | deposit.addBalance(senderAddress, -endowment); |
622 | 628 | contextBalance = deposit.addBalance(contextAddress, endowment); |
623 | 629 | } |
|
0 commit comments