Skip to content

Commit 1e8d839

Browse files
Merge pull request #6265 from zeusoo001/opt-log
feat(log): optimize log information
2 parents e74ce69 + ed324ea commit 1e8d839

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

Diff for: framework/src/main/java/org/tron/common/logsfilter/capsule/TransactionLogTriggerCapsule.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public TransactionLogTriggerCapsule(TransactionCapsule trxCapsule, BlockCapsule
6565

6666
public TransactionLogTriggerCapsule(TransactionCapsule trxCapsule, BlockCapsule blockCapsule,
6767
int txIndex, long preCumulativeEnergyUsed, long preCumulativeLogCount,
68-
TransactionInfo transactionInfo, long energyUnitPrice, boolean flag) {
68+
TransactionInfo transactionInfo, long energyUnitPrice, boolean isNewEventService) {
6969
transactionLogTrigger = new TransactionLogTrigger();
7070

7171
String blockHash = "";
@@ -309,7 +309,7 @@ public TransactionLogTriggerCapsule(TransactionCapsule trxCapsule, BlockCapsule
309309
getInternalTransactionList(programResult.getInternalTransactions()));
310310
}
311311

312-
if (Objects.isNull(trxTrace) && Objects.nonNull(transactionInfo) && flag) {
312+
if (Objects.isNull(trxTrace) && Objects.nonNull(transactionInfo) && isNewEventService) {
313313
Protocol.ResourceReceipt receipt = transactionInfo.getReceipt();
314314
energyUsageTotal = receipt.getEnergyUsageTotal();
315315
transactionLogTrigger.setEnergyFee(receipt.getEnergyFee());

Diff for: framework/src/main/java/org/tron/core/Wallet.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3484,7 +3484,7 @@ private void checkShieldedTRC20NoteValue(
34843484
throw new ContractValidateException("The value in SpendNoteTRC20 must >= 0");
34853485
}
34863486
if (StringUtils.isEmpty(spendNote.getNote().getPaymentAddress())) {
3487-
throw new ContractValidateException("Payment Address in SpendNote should not be empty");
3487+
throw new ContractValidateException("PaymentAddress in SpendNote should not be empty");
34883488
}
34893489
}
34903490
}
@@ -3495,7 +3495,7 @@ private void checkShieldedTRC20NoteValue(
34953495
throw new ContractValidateException("The value in ReceiveNote must >= 0");
34963496
}
34973497
if (StringUtils.isEmpty(receiveNote.getNote().getPaymentAddress())) {
3498-
throw new ContractValidateException("Payment Address in ReceiveNote should not be empty");
3498+
throw new ContractValidateException("PaymentAddress in ReceiveNote should not be empty");
34993499
}
35003500
}
35013501
}

Diff for: framework/src/main/java/org/tron/core/services/event/BlockEventLoad.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@ public synchronized void load() throws Exception {
7272
if (tmpNum > cacheHeadNum + MAX_LOAD_NUM) {
7373
tmpNum = cacheHeadNum + MAX_LOAD_NUM;
7474
}
75-
List<BlockEvent> l1 = new ArrayList<>();
76-
List<BlockEvent> l2 = new ArrayList<>();
75+
List<BlockEvent> blockEvents = new ArrayList<>();
76+
List<BlockEvent> rollbackBlockEvents = new ArrayList<>();
7777
BlockEvent tmp = BlockEventCache.getHead();
7878

7979
BlockEvent blockEvent = blockEventGet.getBlockEvent(tmpNum);
80-
l1.add(blockEvent);
80+
blockEvents.add(blockEvent);
8181
while (!blockEvent.getParentId().equals(tmp.getBlockId())) {
8282
tmpNum--;
8383
if (tmpNum == tmp.getBlockId().getNum()) {
84-
l2.add(tmp);
84+
rollbackBlockEvents.add(tmp);
8585
tmp = BlockEventCache.getBlockEvent(tmp.getParentId());
8686
}
8787
blockEvent = blockEventGet.getBlockEvent(tmpNum);
88-
l1.add(blockEvent);
88+
blockEvents.add(blockEvent);
8989
}
9090

91-
l2.forEach(e -> realtimeEventService.add(new Event(e, true)));
91+
rollbackBlockEvents.forEach(e -> realtimeEventService.add(new Event(e, true)));
9292

93-
List<BlockEvent> l = Lists.reverse(l1);
93+
List<BlockEvent> l = Lists.reverse(blockEvents);
9494
for (BlockEvent e: l) {
9595
BlockEventCache.add(e);
9696
realtimeEventService.add(new Event(e, false));

Diff for: framework/src/test/java/org/tron/core/ShieldWalletTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void testCreateShieldedContractParameters2() throws ContractExeException
376376
Assert.fail();
377377
} catch (Exception e) {
378378
Assert.assertTrue(e instanceof ContractValidateException);
379-
Assert.assertEquals("Payment Address in ReceiveNote should not be empty",
379+
Assert.assertEquals("PaymentAddress in ReceiveNote should not be empty",
380380
e.getMessage());
381381
}
382382

@@ -409,7 +409,7 @@ public void testCreateShieldedContractParameters2() throws ContractExeException
409409
Assert.fail();
410410
} catch (Exception e) {
411411
Assert.assertTrue(e instanceof ContractValidateException);
412-
Assert.assertEquals("Payment Address in SpendNote should not be empty",
412+
Assert.assertEquals("PaymentAddress in SpendNote should not be empty",
413413
e.getMessage());
414414
}
415415
}

0 commit comments

Comments
 (0)