-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
simplifies parse [sanitized] vote transaction #22127
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22127 +/- ##
=======================================
Coverage 81.1% 81.1%
=======================================
Files 521 521
Lines 146326 146311 -15
=======================================
- Hits 118788 118787 -1
+ Misses 27538 27524 -14 |
c7d5e42
to
c14f30d
Compare
let first_instruction = message.instructions.first()?; | ||
let program_id_index = usize::from(first_instruction.program_id_index); | ||
let program_id = message.account_keys.get(program_id_index)?; |
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.
let first_instruction = message.instructions.first()?; | |
let program_id_index = usize::from(first_instruction.program_id_index); | |
let program_id = message.account_keys.get(program_id_index)?; | |
let program_id = message.program_id(0)?; |
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.
You are right. but I prefer to keep this commit precisely the same logic as the existing code.
We can introduce that change in a separate commit
if !crate::check_id(program_id) { | ||
return None; | ||
} | ||
let first_account = usize::from(*first_instruction.accounts.first()?); |
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.
let first_account = usize::from(*first_instruction.accounts.first()?); | |
let first_instruction = message.instructions.first()?; | |
let first_account = usize::from(*first_instruction.accounts.first()?); |
Problem
verbose convoluted code.
Summary of Changes
simplified the code; removed ~30 lines of code.