Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/org/tron/common/runtime/RuntimeImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ public long getTotalEnergyLimitWithFixRatio(AccountCapsule creator, AccountCapsu
public long getTotalEnergyLimit(AccountCapsule creator, AccountCapsule caller,
TriggerSmartContract contract, long feeLimit, long callValue)
throws ContractValidateException {
if (VMConfig.allowTvmConstantinople()) {
if (Objects.isNull(creator)) {
return getAccountEnergyLimitWithFixRatio(caller, feeLimit, callValue);
}
}
// according to version
if (VMConfig.getEnergyLimitHardFork()) {
return getTotalEnergyLimitWithFixRatio(creator, caller, contract, feeLimit, callValue);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/tron/core/capsule/ReceiptCapsule.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.tron.core.capsule;

import java.util.Objects;
import lombok.Getter;
import lombok.Setter;
import org.tron.common.runtime.config.VMConfig;
Expand Down Expand Up @@ -105,6 +106,13 @@ public void payEnergyBill(Manager manager, AccountCapsule origin, AccountCapsule
return;
}

if (VMConfig.allowTvmConstantinople()) {
if (Objects.isNull(origin)) {
payEnergyBill(manager, caller, receipt.getEnergyUsageTotal(), energyProcessor, now);
return;
}
}

if (caller.getAddress().equals(origin.getAddress())) {
payEnergyBill(manager, caller, receipt.getEnergyUsageTotal(), energyProcessor, now);
} else {
Expand Down