Skip to content

Commit ee29c72

Browse files
author
wubin1
committed
add history switch
1 parent 8b5a2cb commit ee29c72

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/tron/core/db/TransactionRetStore.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import com.google.protobuf.ByteString;
44
import java.util.Objects;
55
import lombok.extern.slf4j.Slf4j;
6+
import org.apache.commons.lang3.BooleanUtils;
67
import org.springframework.beans.factory.annotation.Autowired;
78
import org.springframework.beans.factory.annotation.Value;
89
import org.springframework.stereotype.Component;
910
import org.tron.common.utils.ByteArray;
1011
import org.tron.core.capsule.TransactionInfoCapsule;
1112
import org.tron.core.capsule.TransactionRetCapsule;
13+
import org.tron.core.config.args.Args;
1214
import org.tron.core.exception.BadItemException;
1315
import org.tron.protos.Protocol.TransactionInfo;
1416

@@ -24,6 +26,13 @@ public TransactionRetStore(@Value("transactionRetStore") String dbName) {
2426
super(dbName);
2527
}
2628

29+
@Override
30+
public void put(byte[] key, TransactionRetCapsule item) {
31+
if (BooleanUtils.toBoolean(Args.getInstance().getStorage().getTransactionHistoreSwitch())) {
32+
super.put(key, item);
33+
}
34+
}
35+
2736
public TransactionInfoCapsule getTransactionInfo(byte[] key) throws BadItemException {
2837
long blockNumber = transactionStore.getBlockNumber(key);
2938
if (blockNumber == -1) {

0 commit comments

Comments
 (0)