Skip to content
Merged

fix bug #1391

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
31 changes: 1 addition & 30 deletions src/main/java/org/tron/common/runtime/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public class Runtime {
private Deposit deposit;
private ProgramInvokeFactory programInvokeFactory = null;
private String runtimeError;
private boolean readyToExecute = false;

private EnergyProcessor energyProcessor = null;
private StorageMarket storageMarket = null;
Expand Down Expand Up @@ -199,27 +198,6 @@ public void precompiled() throws ContractValidateException, ContractExeException
}
}

/**
*/
public void init() {
readyToExecute = true;
// switch (trxType) {
// case TRX_PRECOMPILED_TYPE:
// readyToExecute = true;
// break;
// case TRX_CONTRACT_CREATION_TYPE:
// case TRX_CONTRACT_CALL_TYPE:
// // if (!curENERGYLimitReachedBlockENERGYLimit()) {
// // readyToExecute = true;
// // }
// readyToExecute = true;
// break;
// default:
// readyToExecute = true;
// break;
// }
}


public BigInteger getBlockCPULeftInUs() {

Expand Down Expand Up @@ -260,10 +238,6 @@ public boolean curCPULimitReachedBlockCPULimit() {
}

public void execute() throws ContractValidateException, ContractExeException {

if (!readyToExecute) {
return;
}
switch (trxType) {
case TRX_PRECOMPILED_TYPE:
precompiled();
Expand All @@ -275,7 +249,7 @@ public void execute() throws ContractValidateException, ContractExeException {
call();
break;
default:
break;
throw new ContractValidateException("Unknown contract type");
}
}

Expand Down Expand Up @@ -505,9 +479,6 @@ private void call()
}

public void go() throws OutOfSlotTimeException {
if (!readyToExecute) {
return;
}

try {
if (vm != null) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/tron/core/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ public Transaction triggerContract(TriggerSmartContract triggerSmartContract,

Runtime runtime = new Runtime(trxCap.getInstance(), headBlock, deposit,
new ProgramInvokeFactoryImpl());
runtime.init();
runtime.execute();
runtime.go();
runtime.finalization();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ public boolean processTransaction(final TransactionCapsule trxCap, Block block)

trace.init();
trace.exec(runtime);
trace.pay();

transactionStore.put(trxCap.getTransactionId().getBytes(), trxCap);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tron/core/db/TransactionTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public void setNetBill(long netUsage, long netFee) {
public void exec(Runtime runtime)
throws ContractExeException, ContractValidateException, OutOfSlotTimeException {
/** VM execute **/
runtime.init();
runtime.execute();
runtime.go();
pay();
runtime.finalization();
}

Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/tron/common/runtime/TVMTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ public static TVMTestResult processTransactionAndReturnTVMTestResult(Transaction
//exec
trace.exec(runtime);

trace.pay();

return new TVMTestResult(runtime, trace.getReceipt(), null);
}

Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/tron/core/db/TransactionTraceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ public void testUseFee() throws InvalidProtocolBufferException {
new ProgramInvokeFactoryImpl());
try {
trace.exec(runtime);
trace.pay();
Assert.assertEquals(0, trace.getReceipt().getEnergyUsage());
Assert.assertEquals(49503930, trace.getReceipt().getEnergyFee());
// Assert.assertEquals(deployStorageDelta, trace.getReceipt().getStorageDelta());
Expand Down