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
9 changes: 9 additions & 0 deletions src/main/java/org/tron/common/runtime/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ private void create()
long vmShouldEndInUs = vmStartInUs + thisTxCPULimitInUs;

long feeLimit = trx.getRawData().getFeeLimit();
if (feeLimit < 0) {
logger.info("feeLimit < 0");
throw new ContractValidateException("feeLimit must be >= 0");
}

long energyLimit = getEnergyLimit(creator, feeLimit, callValue);
byte[] ops = newSmartContract.getBytecode().toByteArray();
InternalTransaction internalTransaction = new InternalTransaction(trx);
Expand Down Expand Up @@ -420,6 +425,10 @@ private void call()
long vmShouldEndInUs = vmStartInUs + thisTxCPULimitInUs;

long feeLimit = trx.getRawData().getFeeLimit();
if (feeLimit < 0) {
logger.info("feeLimit < 0");
throw new ContractValidateException("feeLimit must be >= 0");
}
long energyLimit;
if (isCallConstant(contractAddress)) {
energyLimit = Constant.MAX_ENERGY_IN_TX;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tron/core/capsule/ReceiptCapsule.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public long getNetFee() {
*/
public void payEnergyBill(Manager manager, AccountCapsule origin, AccountCapsule caller,
long percent, EnergyProcessor energyProcessor, long now) throws BalanceInsufficientException {
if (0 == receipt.getEnergyUsageTotal()) {
if (receipt.getEnergyUsageTotal() <= 0) {
return;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/tron/core/db/TransactionTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public void init() throws TransactionTraceException {

//set bill
public void setBill(long energyUsage) {
if (energyUsage < 0) {
energyUsage = 0L;
}
receipt.setEnergyUsageTotal(energyUsage);
}

Expand Down