Skip to content

Commit ddccce4

Browse files
committed
print trx size from pending and repush after generating block
1 parent cdbbb0a commit ddccce4

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,7 @@ public BlockCapsule generateBlock(Miner miner, long blockTime, long timeout) {
15691569
List<TransactionCapsule> toBePacked = new ArrayList<>();
15701570
long currentSize = blockCapsule.getInstance().getSerializedSize();
15711571
boolean isSort = Args.getInstance().isOpenTransactionSort();
1572+
int[] logSize = new int[] {pendingTransactions.size(), rePushTransactions.size(), 0, 0};
15721573
while (pendingTransactions.size() > 0 || rePushTransactions.size() > 0) {
15731574
boolean fromPending = false;
15741575
TransactionCapsule trx;
@@ -1644,6 +1645,11 @@ public BlockCapsule generateBlock(Miner miner, long blockTime, long timeout) {
16441645
tmpSession.merge();
16451646
toBePacked.add(trx);
16461647
currentSize += trxPackSize;
1648+
if (fromPending) {
1649+
logSize[2] += 1;
1650+
} else {
1651+
logSize[3] += 1;
1652+
}
16471653
} catch (Exception e) {
16481654
logger.warn("Process trx {} failed when generating block {}, {}.", trx.getTransactionId(),
16491655
blockCapsule.getNum(), e.getMessage());
@@ -1660,11 +1666,14 @@ public BlockCapsule generateBlock(Miner miner, long blockTime, long timeout) {
16601666
BlockCapsule capsule = new BlockCapsule(blockCapsule.getInstance());
16611667
capsule.generatedByMyself = true;
16621668
Metrics.histogramObserve(timer);
1663-
logger.info("Generate block {} success, trxs:{}, pendingCount: {}, rePushCount: {},"
1664-
+ " postponedCount: {}, blockSize: {} B",
1665-
capsule.getNum(), capsule.getTransactions().size(),
1666-
pendingTransactions.size(), rePushTransactions.size(), postponedTrxCount,
1667-
capsule.getSerializedSize());
1669+
logger.info("Generate block {} success, trxs:{}, before pendingCount: {}, rePushCount: {}, "
1670+
+ "from pending: {}, rePush: {}, after pendingCount: {}, rePushCount: {}, "
1671+
+ "postponedCount: {}, blockSize: {} B",
1672+
capsule.getNum(), capsule.getTransactions().size(),
1673+
logSize[0], logSize[1], logSize[2], logSize[3],
1674+
pendingTransactions.size(), rePushTransactions.size(), postponedTrxCount,
1675+
capsule.getSerializedSize());
1676+
16681677
return capsule;
16691678
}
16701679

0 commit comments

Comments
 (0)