Skip to content

Commit 2ca509c

Browse files
committed
move time ret to transaction trace
1 parent 951454c commit 2ca509c

4 files changed

Lines changed: 18 additions & 10 deletions

File tree

‎src/main/java/org/tron/core/capsule/TransactionCapsule.java‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.tron.common.utils.Sha256Hash;
5050
import org.tron.core.Wallet;
5151
import org.tron.core.db.AccountStore;
52+
import org.tron.core.db.TransactionTrace;
5253
import org.tron.core.exception.BadItemException;
5354
import org.tron.core.exception.ValidateSignatureException;
5455
import org.tron.protos.Contract;
@@ -86,15 +87,9 @@ public class TransactionCapsule implements ProtoCapsule<Transaction> {
8687
@Setter
8788
private boolean isVerified = false;
8889

89-
public enum TimeResultType {
90-
NORMAL,
91-
LONG_RUNNING,
92-
OUT_OF_TIME
93-
}
94-
9590
@Getter
9691
@Setter
97-
private TimeResultType timeResultType = TimeResultType.NORMAL;
92+
private TransactionTrace trxTrace;
9893

9994
/**
10095
* constructor TransactionCapsule.

‎src/main/java/org/tron/core/db/Manager.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@ public boolean processTransaction(final TransactionCapsule trxCap, BlockCapsule
10291029
}
10301030

10311031
TransactionTrace trace = new TransactionTrace(trxCap, this);
1032+
trxCap.setTrxTrace(trace);
10321033

10331034
consumeBandwidth(trxCap, trace);
10341035

‎src/main/java/org/tron/core/db/PendingManager.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import lombok.Getter;
66
import lombok.extern.slf4j.Slf4j;
77
import org.tron.core.capsule.TransactionCapsule;
8-
import org.tron.core.capsule.TransactionCapsule.TimeResultType;
8+
import org.tron.core.db.TransactionTrace.TimeResultType;
99

1010
@Slf4j
1111
public class PendingManager implements AutoCloseable {
@@ -27,7 +27,7 @@ public void close() {
2727

2828
for (TransactionCapsule tx : this.tmpTransactions) {
2929
try {
30-
if (!tx.getTimeResultType().equals(TimeResultType.LONG_RUNNING)) {
30+
if (!tx.getTrxTrace().getTimeResultType().equals(TimeResultType.LONG_RUNNING)) {
3131
dbManager.getRepushTransactions().put(tx);
3232
}
3333
} catch (InterruptedException e) {
@@ -39,7 +39,7 @@ public void close() {
3939

4040
for (TransactionCapsule tx : dbManager.getPoppedTransactions()) {
4141
try {
42-
if (!tx.getTimeResultType().equals(TimeResultType.LONG_RUNNING)) {
42+
if (!tx.getTrxTrace().getTimeResultType().equals(TimeResultType.LONG_RUNNING)) {
4343
dbManager.getRepushTransactions().put(tx);
4444
}
4545
} catch (InterruptedException e) {

‎src/main/java/org/tron/core/db/TransactionTrace.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import static org.tron.common.runtime.vm.program.InternalTransaction.TrxType.TRX_PRECOMPILED_TYPE;
66

77
import java.util.Objects;
8+
import lombok.Getter;
9+
import lombok.Setter;
810
import lombok.extern.slf4j.Slf4j;
911
import org.springframework.util.StringUtils;
1012
import org.tron.common.runtime.Runtime;
@@ -50,6 +52,16 @@ public TransactionCapsule getTrx() {
5052
return trx;
5153
}
5254

55+
public enum TimeResultType {
56+
NORMAL,
57+
LONG_RUNNING,
58+
OUT_OF_TIME
59+
}
60+
61+
@Getter
62+
@Setter
63+
private TimeResultType timeResultType = TimeResultType.NORMAL;
64+
5365
public TransactionTrace(TransactionCapsule trx, Manager dbManager) {
5466
this.trx = trx;
5567
Transaction.Contract.ContractType contractType = this.trx.getInstance().getRawData()

0 commit comments

Comments
 (0)