diff --git a/actuator/src/main/java/org/tron/core/vm/program/Program.java b/actuator/src/main/java/org/tron/core/vm/program/Program.java index 1c9aae2f4f8..7dd89fb1edc 100644 --- a/actuator/src/main/java/org/tron/core/vm/program/Program.java +++ b/actuator/src/main/java/org/tron/core/vm/program/Program.java @@ -508,7 +508,9 @@ public void suicide(DataWord obtainerAddress) { byte[] owner = TransactionTrace.convertToTronAddress(getContractAddress().getLast20Bytes()); byte[] obtainer = TransactionTrace.convertToTronAddress(obtainerAddress.getLast20Bytes()); - withdrawRewardToBalance(owner, getContractState()); + if (VMConfig.allowTvmStake()) { + withdrawRewardToBalance(owner, getContractState()); + } long balance = getContractState().getBalance(owner); @@ -546,17 +548,19 @@ public void suicide(DataWord obtainerAddress) { throw new BytecodeExecutionException("transfer failure"); } } - suicideFreezeBalanceAndVote(owner, obtainer, getContractState()); + if (VMConfig.allowTvmStake()) { + suicideFreezeBalanceAndVote(owner, obtainer, getContractState()); + //delete delegationStore + getResult().addDeleteDelegation(this.getContractAddress()); + } getResult().addDeleteAccount(this.getContractAddress()); - //delete delegationStore - getResult().addDeleteDelegation(this.getContractAddress()); } public Repository getContractState() { return this.contractState; } - private void withdrawRewardToBalance(byte[] owner, Repository repository){ + private void withdrawRewardToBalance(byte[] owner, Repository repository) { ContractService contractService = ContractService.getInstance(); contractService.withdrawReward(owner, getContractState()); AccountCapsule accountCapsule = repository.getAccount(owner); @@ -575,9 +579,6 @@ private void withdrawRewardToBalance(byte[] owner, Repository repository){ } private void suicideFreezeBalanceAndVote(byte[] owner, byte[] obtainer, Repository repository) { - if (!VMConfig.allowTvmStake()) { - return; - } AccountCapsule ownerCapsule = repository.getAccount(owner); if (ownerCapsule.getFrozenCount() == 0) { return;