16
16
import org .tron .common .logsfilter .trigger .ContractTrigger ;
17
17
import org .tron .common .runtime .vm .DataWord ;
18
18
import org .tron .common .runtime .vm .LogInfo ;
19
- import org .tron .common .utils .ByteArraySet ;
20
19
import org .tron .core .capsule .TransactionResultCapsule ;
21
20
import org .tron .protos .Protocol .Transaction .Result .contractResult ;
22
21
@@ -29,7 +28,7 @@ public class ProgramResult {
29
28
private long energyPenalty = 0 ;
30
29
31
30
@ Getter
32
- private long energyOrigin = 0 ;
31
+ private long energyPenaltyTotal = 0 ;
33
32
34
33
private byte [] hReturn = EMPTY_BYTE_ARRAY ;
35
34
private byte [] contractAddress = EMPTY_BYTE_ARRAY ;
@@ -68,12 +67,11 @@ public static ProgramResult createEmpty() {
68
67
69
68
public void spendEnergy (long energy ) {
70
69
energyUsed += energy ;
71
- energyOrigin += energy ;
72
70
}
73
71
74
72
public void spendEnergyWithPenalty (long origin , long penalty ) {
75
- energyOrigin += origin ;
76
73
energyPenalty += penalty ;
74
+ energyPenaltyTotal += penalty ;
77
75
energyUsed += origin + penalty ;
78
76
}
79
77
@@ -89,6 +87,10 @@ public void refundEnergy(long energy) {
89
87
energyUsed -= energy ;
90
88
}
91
89
90
+ public void addTotalPenalty (long penalty ) {
91
+ energyPenaltyTotal += penalty ;
92
+ }
93
+
92
94
public byte [] getContractAddress () {
93
95
return Arrays .copyOf (contractAddress , contractAddress .length );
94
96
}
@@ -243,6 +245,7 @@ public void merge(ProgramResult another) {
243
245
if (another .getException () == null && !another .isRevert ()) {
244
246
addDeleteAccounts (another .getDeleteAccounts ());
245
247
addLogInfos (another .getLogInfoList ());
248
+ addTotalPenalty (another .getEnergyPenaltyTotal ());
246
249
//addFutureRefund(another.getFutureRefund());
247
250
//addTouchAccounts(another.getTouchedAccounts());
248
251
}
0 commit comments