-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Optimization postLogsFilter #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/gemini
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2268,10 +2268,17 @@ private void postBlockFilter(final BlockCapsule blockCapsule, boolean solidified | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| private void postLogsFilter(final BlockCapsule blockCapsule, boolean solidified, | ||||||||||||||||||||||||||||||||||
| boolean removed) { | ||||||||||||||||||||||||||||||||||
| long blockNumber = blockCapsule.getNum(); | ||||||||||||||||||||||||||||||||||
| if (!blockCapsule.getTransactions().isEmpty()) { | ||||||||||||||||||||||||||||||||||
| long blockNumber = blockCapsule.getNum(); | ||||||||||||||||||||||||||||||||||
| List<TransactionInfo> transactionInfoList | ||||||||||||||||||||||||||||||||||
| = getTransactionInfoByBlockNum(blockNumber).getTransactionInfoList(); | ||||||||||||||||||||||||||||||||||
| List<TransactionInfo> transactionInfoList; | ||||||||||||||||||||||||||||||||||
| // Optimization: If the block result is already in memory, use it directly. | ||||||||||||||||||||||||||||||||||
| // Avoids re-querying the database for data just written. | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 There's a typo in the method name
Suggested change
|
||||||||||||||||||||||||||||||||||
| if (blockCapsule.getResult() != null) { | ||||||||||||||||||||||||||||||||||
| transactionInfoList = blockCapsule.getResult().getInstance().getTransactioninfoList(); | ||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||
| // Fallback to querying from DB if not available in memory. | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+2274
to
+2279
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 For better readability and to avoid multiple calls to
Suggested change
|
||||||||||||||||||||||||||||||||||
| transactionInfoList = getTransactionInfoByBlockNum(blockNumber).getTransactionInfoList(); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+2275
to
+2281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🟡 The comment in the `else` block is redundant because the code is self-explanatory. Consider removing it to make the code cleaner.
Suggested change
|
||||||||||||||||||||||||||||||||||
| LogsFilterCapsule logsFilterCapsule = new LogsFilterCapsule(blockNumber, | ||||||||||||||||||||||||||||||||||
| blockCapsule.getBlockId().toString(), blockCapsule.getBloom(), transactionInfoList, | ||||||||||||||||||||||||||||||||||
| solidified, removed); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 For better scoping, consider moving the declaration of
blockNumberinside the followingifblock, as it is only used there.