Skip to content

Commit 36b4ca0

Browse files
authored
Merge pull request #3799 from forfreeday/memory_optimization
memory optimization
2 parents 37bcecf + 3587964 commit 36b4ca0

File tree

6 files changed

+8
-13
lines changed

6 files changed

+8
-13
lines changed

framework/src/main/java/org/tron/core/Wallet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,17 +1320,17 @@ public TransactionInfo getTransactionInfoById(ByteString transactionId) {
13201320
}
13211321
TransactionInfoCapsule transactionInfoCapsule;
13221322
try {
1323-
transactionInfoCapsule = chainBaseManager.getTransactionHistoryStore()
1324-
.get(transactionId.toByteArray());
1323+
transactionInfoCapsule = chainBaseManager.getTransactionRetStore()
1324+
.getTransactionInfo(transactionId.toByteArray());
13251325
} catch (StoreException e) {
13261326
return null;
13271327
}
13281328
if (transactionInfoCapsule != null) {
13291329
return transactionInfoCapsule.getInstance();
13301330
}
13311331
try {
1332-
transactionInfoCapsule = chainBaseManager.getTransactionRetStore()
1333-
.getTransactionInfo(transactionId.toByteArray());
1332+
transactionInfoCapsule = chainBaseManager.getTransactionHistoryStore()
1333+
.get(transactionId.toByteArray());
13341334
} catch (BadItemException e) {
13351335
return null;
13361336
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,7 @@ public TransactionInfo processTransaction(final TransactionCapsule trxCap, Block
11971197
}
11981198
//set the sort order
11991199
trxCap.setOrder(transactionInfo.getFee());
1200+
trxCap.setTrxTrace(null);
12001201
return transactionInfo.getInstance();
12011202
}
12021203

framework/src/main/java/org/tron/core/net/messagehandler/FetchInvDataMsgHandler.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ private void check(PeerConnection peer, FetchInvDataMessage fetchInvDataMsg) thr
146146
int maxCount = advService.getTrxCount().getCount(60);
147147
if (fetchCount > maxCount) {
148148
logger.error("maxCount: " + maxCount + ", fetchCount: " + fetchCount);
149-
// throw new P2pException(TypeEnum.BAD_MESSAGE,
150-
// "maxCount: " + maxCount + ", fetchCount: " + fetchCount);
151149
}
152150
} else {
153151
boolean isAdv = true;
@@ -165,9 +163,6 @@ private void check(PeerConnection peer, FetchInvDataMessage fetchInvDataMsg) thr
165163
if (outBlockCountIn1min > producedBlockIn2min) {
166164
logger.error("producedBlockIn2min: " + producedBlockIn2min + ", outBlockCountIn1min: "
167165
+ outBlockCountIn1min);
168-
//throw new P2pException(TypeEnum.BAD_MESSAGE, "producedBlockIn2min: "
169-
// + producedBlockIn2min
170-
// + ", outBlockCountIn1min: " + outBlockCountIn1min);
171166
}
172167
} else {
173168
if (!peer.isNeedSyncFromUs()) {

framework/src/main/java/org/tron/core/net/messagehandler/TransactionsMsgHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class TransactionsMsgHandler implements TronMsgHandler {
3737
@Autowired
3838
private AdvService advService;
3939

40-
// private static int TIME_OUT = 10 * 60 * 1000;
4140
private BlockingQueue<TrxEvent> smartContractQueue = new LinkedBlockingQueue(MAX_TRX_SIZE);
4241

4342
private BlockingQueue<Runnable> queue = new LinkedBlockingQueue();

framework/src/main/java/org/tron/core/net/peer/PeerStatusCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void init() {
2727
try {
2828
statusCheck();
2929
} catch (Exception e) {
30-
logger.error("Unhandled exception", e);
30+
logger.error("", e);
3131
}
3232
}, 5, 2, TimeUnit.SECONDS);
3333
}

framework/src/main/java/org/tron/core/net/service/AdvService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ public void init() {
8383
try {
8484
consumerInvToSpread();
8585
} catch (Exception exception) {
86-
logger.error("Spread thread error.", exception.getMessage());
86+
logger.error("Spread thread error. {}", exception.getMessage());
8787
}
8888
}, 100, 30, TimeUnit.MILLISECONDS);
8989

9090
fetchExecutor.scheduleWithFixedDelay(() -> {
9191
try {
9292
consumerInvToFetch();
9393
} catch (Exception exception) {
94-
logger.error("Fetch thread error.", exception.getMessage());
94+
logger.error("Fetch thread error. {}", exception.getMessage());
9595
}
9696
}, 100, 30, TimeUnit.MILLISECONDS);
9797
}

0 commit comments

Comments
 (0)