-
Notifications
You must be signed in to change notification settings - Fork 180
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
[Access] Sort events returned from index in tx index order - backport #5444
Conversation
[Access] Sort events returned from index in tx index order
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5444 +/- ##
==========================================
+ Coverage 55.99% 56.01% +0.01%
==========================================
Files 1026 1026
Lines 99815 99824 +9
==========================================
+ Hits 55894 55917 +23
+ Misses 39627 39610 -17
- Partials 4294 4297 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
if events[i].TransactionIndex == events[j].TransactionIndex { | ||
return events[i].EventIndex < events[j].EventIndex | ||
} | ||
return events[i].TransactionIndex < events[j].TransactionIndex |
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.
Maybe factor the repeated indexing expressions into variables:
if events[i].TransactionIndex == events[j].TransactionIndex { | |
return events[i].EventIndex < events[j].EventIndex | |
} | |
return events[i].TransactionIndex < events[j].TransactionIndex | |
a := events[i] | |
b := events[j] | |
if a.TransactionIndex == b.TransactionIndex { | |
return a.EventIndex < b.EventIndex | |
} | |
return a.TransactionIndex < b.TransactionIndex |
cmp := bytes.Compare(events[i].TransactionID[:], events[j].TransactionID[:]) | ||
if cmp == 0 { | ||
if events[i].TransactionIndex == events[j].TransactionIndex { | ||
return events[i].EventIndex < events[j].EventIndex | ||
} | ||
return events[i].TransactionIndex < events[j].TransactionIndex |
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.
Same as above
Backport: #5404